mirror of
https://github.com/Anvilcraft/jensmemes
synced 2024-11-14 14:01:55 +01:00
Update bot.py
This commit is contained in:
parent
0c4000cf7c
commit
cb4605a8f9
1 changed files with 14 additions and 11 deletions
25
Bot/bot.py
25
Bot/bot.py
|
@ -18,18 +18,21 @@ async def on_ready():
|
||||||
async def register(ctx):
|
async def register(ctx):
|
||||||
if not ctx.guild.id in allowedDiscordServer:
|
if not ctx.guild.id in allowedDiscordServer:
|
||||||
return
|
return
|
||||||
name = str(ctx.author)
|
try:
|
||||||
token = md5(str(ctx.author.id).encode()).hexdigest()
|
name = str(ctx.author)
|
||||||
user = bot.get_user(ctx.author.id)
|
token = md5(str(ctx.author.id).encode()).hexdigest()
|
||||||
|
user = bot.get_user(ctx.author.id)
|
||||||
|
|
||||||
db = pymysql.connect(sqlServer,sqlUser,sqlPassword,sqlDatabase )
|
db = pymysql.connect(sqlServer,sqlUser,sqlPassword,sqlDatabase )
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
cursor.execute("SELECT * FROM token WHERE name=%s AND token=%s", (name, token))
|
cursor.execute("SELECT * FROM token WHERE name=%s AND token=%s", (name, token))
|
||||||
if(len(cursor.fetchall()) == 0):
|
if(len(cursor.fetchall()) == 0):
|
||||||
cursor.execute("INSERT INTO token (name, token, uploadsLast24H) VALUES (%s, %s, 0)", (name, token))
|
cursor.execute("INSERT INTO token (name, token, uploadsLast24H) VALUES (%s, %s, 0)", (name, token))
|
||||||
db.commit()
|
db.commit()
|
||||||
db.close()
|
db.close()
|
||||||
|
|
||||||
await user.send("Your Token for Jensmemes is " + token + "\n You can now use https://jensmemes.tilera.xyz/ !")
|
await user.send("Your Token for Jensmemes is " + token + "\n You can now use https://jensmemes.tilera.xyz/ !")
|
||||||
|
except:
|
||||||
|
ctx.send("Failed to send message, please check if you have enabled PM")
|
||||||
|
|
||||||
bot.run(token, bot=botAccount)#start the bot with the options in config.py
|
bot.run(token, bot=botAccount)#start the bot with the options in config.py
|
||||||
|
|
Loading…
Reference in a new issue