Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import discord
- def execute(code):
- res = {}
- try:
- exec(code,{},res)
- except Exception as e:
- return str(e)
- return str(res)
- client = discord.Client()
- @client.event
- async def on_message(message):
- # we do not want the bot to reply to itself
- if message.author == client.user:
- return
- if message.content.startswith('!exec'):
- msg = execute(message.content[6:])
- await client.send_message(message.channel, msg)
- @client.event
- async def on_ready():
- print('Logged in as')
- print(client.user.name)
- print(client.user.id)
- print('------')
- client.run('token')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement