Advertisement
AbsoluteGamer

Bad Discord Bot

Jun 1st, 2017
540
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.64 KB | None | 0 0
  1. import discord
  2.  
  3. def execute(code):
  4.     res = {}
  5.     try:
  6.         exec(code,{},res)
  7.     except Exception as e:
  8.         return str(e)
  9.     return str(res)
  10.  
  11. client = discord.Client()
  12.  
  13. @client.event
  14. async def on_message(message):
  15.     # we do not want the bot to reply to itself
  16.     if message.author == client.user:
  17.         return
  18.  
  19.     if message.content.startswith('!exec'):
  20.         msg = execute(message.content[6:])
  21.         await client.send_message(message.channel, msg)
  22.  
  23. @client.event
  24. async def on_ready():
  25.     print('Logged in as')
  26.     print(client.user.name)
  27.     print(client.user.id)
  28.     print('------')
  29.  
  30. client.run('token')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement