mirror of https://github.com/kurisufriend/bbpy
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
719 B
26 lines
719 B
import discord
|
|
import asyncio
|
|
from io import StringIO
|
|
from contextlib import redirect_stdout
|
|
|
|
print(discord.__version__)
|
|
dclient = discord.Client()
|
|
|
|
exec_env_global = dict()
|
|
exec_env_local = dict()
|
|
|
|
@dclient.event
|
|
async def on_message(message):
|
|
if message.content.startswith(".bbpy "):
|
|
message.content = message.content.replace(".bbpy ", "")
|
|
print(message.content)
|
|
try:
|
|
f = StringIO()
|
|
with redirect_stdout(f):
|
|
exec(message.content, exec_env_global, exec_env_local)
|
|
await message.channel.send(f.getvalue())
|
|
except Exception as e:
|
|
await message.channel.send(type(e).__name__+str(e.args))
|
|
|
|
|
|
dclient.run("token", bot=True)
|
|
|