StruFu-Bot/Jan/dbtest.py

35 lines
1021 B
Python

import discord
class sf_user:
def __init__(self, username, dmchannel):
self.name = username
self.channel = dmchannel
self.question = 0
self.category = 0
self.semester = 0
client = discord.Client()
users = []
@client.event
async def on_ready():
print("we logged in as {0.user}".format(client))
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.lower().startswith("!start"):
for i in users:
if i.name == message.author:
print(message.author, "is already in database")
return
users.append(sf_user(message.author, await message.author.create_dm()))
await users[-1].channel.send("Hello")
if message.content.lower().startswith("!question") and isinstance(message.channel, discord.channel.DMChannel):
await message.channel.send("Question")
client.run("Nzg1MTkxODM3OTg3MzczMDg2.X80Q4g.bK_vMhhESanMOA78KxHfmJft2vk")