Skip to content
Snippets Groups Projects
Commit 92b92f1b authored by Sydney Anne Erickson's avatar Sydney Anne Erickson :chipmunk:
Browse files

Update discord_bot.py

parent 4411d901
No related branches found
No related tags found
No related merge requests found
import discord
import dataset
from email.utils import parseaddr
from validate_email import validate_email
from discord import user
# pip3 install discord dataset
db = dataset.connect("sqlite:///discord.db")
......@@ -15,12 +17,19 @@ class MyClient(discord.Client):
if message.author == self.user:
return
if not message.guild:
# Don't respond in servers
if message.guild:
return
# Try to grab the user from the list
userOnList = usertable.find_one(user_id=str(message.author.id))
print(userOnList)
# Check if the user is on the list, if not we return
if not userOnList:
await message.channel.send("You are not on the list of Discord community members as taken on 9PM UTC November 4th. Unfortunately, we cannot register you for this sale. If you think this is in error, please contact `sale@xx-coin.io`.")
return
if userOnList:
# Check if we got an email and record it if so
if len(message.content.strip().split(" ")) == 1 and "@" in message.content and \
len(message.content.split("@")) == 2 and "." in message.content.split("@")[1]:
......@@ -30,10 +39,11 @@ class MyClient(discord.Client):
await message.channel.send("You have been registered. Registration and login details will be sent to your email by November 19th. You will not be able to login until then.")
else:
await message.channel.send("Your email address has been updated. Registration and login details will be sent to your email by November 19th. You will not be able to login until then.")
else:
return
# All else has failed, tell the user they are on the list
await message.channel.send("You are on our list! Please reply with a valid email address to register for the token sale.")
else:
await message.channel.send("You are not on the list of Discord community members as taken on 9PM UTC November 4th. Unfortunately, we cannot register you for this sale. If you think this is in error, please contact `sale@xx-coin.io`.")
client = MyClient()
with open("discord.txt", "r") as f:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment