-
Notifications
You must be signed in to change notification settings - Fork 0
/
Story.py
67 lines (54 loc) · 2.41 KB
/
Story.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import discord
from discord.ext import commands
import newfile
import asyncio
import lore_data
import sqlite3
class Story_Mode(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.conn = sqlite3.connect("database.db")
self.c = self.conn.cursor()
@commands.command()
async def storycampaign(self, ctx):
try:
self.c.execute('SELECT category FROM UserCredentials WHERE name = (?)', (ctx.author.name,))
data = self.c.fetchall()
category = data[0][0]
except sqlite3.Error as e:
await ctx.send("It doesn't seem like you have joined yet. Run ```--join <category>``` to join.")
print (e)
return
ProgressText = ""
ResponseChar = ""
Story = ""
Progress = newfile.getStoryProgress(self.c, ctx.author.name)
for _ in lore_data.LoreCharConverter:
if Progress in lore_data.LoreCharConverter[_]:
ProgressText = _
LoadingEmbed = discord.Embed(title = "Story Mode", description = ProgressText)
LoadingEmbed.add_field(name="Are you ready for this? Note: If you abandon the progress before a checkpoint your progress will be lost.", value= ":one: Proceed \n:two: Cancel")
load = await ctx.send(embed = LoadingEmbed)
deterchar = ""
def check(m):
return m.author.id == ctx.author.id and m.content in ["1", "2"] and m.channel.id == ctx.channel.id
try:
message = await self.bot.wait_for("message", timeout = 30, check = check)
if message.content == "1":
deterchar = "Y"
ResponseChar = message.content
elif message.content == "2":
deterchar = "N"
except asyncio.TimeoutError:
deterchar = "N"
if deterchar == "N":
await ctx.send("Very well then, we shall continue some other time.")
else:
emb = discord.Embed(title = "Story Mode", description = ProgressText)
emb.add_field(name = "Story", value= lore_data.Lore[Progress][category][int(ResponseChar)])
await ctx.send(embed= emb)
await ctx.send(lore_data.LoreResponses[Progress][category][int(ResponseChar)])
# def check(m):
# return m.author.id == ctx.author.id and m.contnet in
def setup(bot):
bot.add_cog(Story_Mode(bot))