Fixed -dbadd bug

This commit is contained in:
Sleepingpirates
2020-06-11 13:57:14 -04:00
committed by GitHub
parent d205248c9a
commit 720dc42588

View File

@@ -118,31 +118,34 @@ class MyClient(discord.Client):
if plexremove(mgs):
await message.channel.send('The email has been removed! {0.author.mention}'.format(message))
else:
message.channel.send('Error Check Logs! {0.author.mention}'.format(message))
if message.content.startswith('-dbadd'):
mgs = message.content.replace('-dbadd ','')
try:
mgs = mgs.split(' ')
email = mgs[0]
user_id = mgs[1]
db.save_user(user_id, email)
await message.channel.send('The user {} has been added to db!'.format(mgs[0]))
except:
print("Cannot add this user to db.")
async def on_member_remove(self, member):
if auto_remove_user:
try:
user_id = member.id ## not there
email = db.get_useremail(user_id)
plexremove(email)
deleted = db.delete_user(user_id)
if deleted:
print("Removed {} from db".format(email))
else:
print("Cannot remove this user from db.")
except:
message.channel.send('Error Check Logs! {0.author.mention}'.format(message))
if message.content.startswith('-dbadd'):
mgs = message.content.replace('-dbadd ','')
try:
mgs = mgs.split(' ')
email = mgs[0]
bad_chars = ['<','>','@','!']
user_id = mgs[1]
for i in bad_chars:
user_id = user_id.replace(i, '')
db.save_user(user_id, email)
await message.channel.send('The user {} has been added to db!'.format(mgs[0]))
except:
print("Cannot add this user to db.")
async def on_member_remove(self, member):
if auto_remove_user:
try:
user_id = member.id ## not there
email = db.get_useremail(user_id)
plexremove(email)
deleted = db.delete_user(user_id)
if deleted:
print("Removed {} from db".format(email))
else:
print("Cannot remove this user from db.")
except:
print("Cannot remove this user from plex.")
client = MyClient()