mirror of https://github.com/kurisufriend/bbpy
parent
d475a1e5ef
commit
a9e13d20cb
@ -0,0 +1,26 @@ |
|||||||
|
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("NDgzNzg2NTE1NjM0MTkyNDIz.W4SPTQ.Om0LlT_Pgc7uLDNCfMvXXpPqe7k", bot=True) |
Loading…
Reference in new issue