Answer the question
In order to leave comments, you need to log in
How to make according to the correct discord.py?
I have such code
@bot.command(pass_context=True)
async def exec(ctx, *, text: str):
exec(text)
await ctx.send("Code succesfully executed")
Answer the question
In order to leave comments, you need to log in
Of course, I don’t understand this, but why are you calling the exec function in the exec function itself? As far as I know, in the current version of discord.py, you can not write pass_context=True
Don't use built-in function names for your own functions.
Your team is trying to execute itself.
And I really hope that you are executing this code on a machine that is not a pity. Because giving access to code execution to any Internet user is a bad idea.
@bot.command(name="exec")
@commands.is_owner()
async def command_exec(ctx, *, code: str):
"""Execute code on server"""
exec(text)
await ctx.send("Done")
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question