Advertisement
Guest User

Untitled

a guest
Jan 25th, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.97 KB | None | 0 0
  1. async def addblacklist(message):
  2.     isadmin0 = await isadmin(message.author)
  3.     if isadmin0 == True:
  4.         arguments = message.content.split()
  5.         target = discord.utils.find(lambda m: m.mention == arguments[1], message.channel.server.members)
  6.         isblacklisted = await isblacklist(target)
  7.         if isblacklisted == False:
  8.             connection = await aiomysql.connect(host=str(mysql_host),user=str(mysql_user),password=str(mysql_passwd), db=str(mysql_db), charset='utf8mb4')
  9.             async with connection.cursor(aiomysql.cursors.DictCursor) as cur:
  10.                 sql = "INSERT INTO `blacklist` (`discordid`) VALUES ('" + target.id + "');"
  11.                 await cur.execute(sql)
  12.                 await connection.commit()
  13.                 connection.close()
  14.                 await client.send_message(message.channel, str(target) + " est maintenant blacklisté")
  15.                 return
  16.         else:
  17.             embed=discord.Embed(title="Blacklist", description=str(target) + " est deja blacklisté", color=0xff0000)
  18.             await client.send_message(message.channel, embed=embed)
  19.             return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement