Issue
(Code below is just for entertaining purposes only. Do not use this in discord servers). I honestly have no clue why it isn't working. When I open a new python file with the exact same code, it works. However if I put it in my file with all the code it doesn't for some reason. No output, no errors.
from discord.ext import commands
#Settings
KICK_ON_MESSAGE = False
TOKEN = "Token goes here"
client = commands.Bot(command_prefix="/")
@client.event
async def on_ready():
print('Logged in!')
@client.event
async def on_message(message):
if KICK_ON_MESSAGE == True:
member = message.author
await member.kick()
print(str(member)+' has been succesfully kicked!')
@client.command()
async def test(ctx):
await ctx.send('hi!')
client.run(TOKEN)
Thanks in advance.
Solution
It might be because you didn't process the commands at the on_message
event.
Simply add await client.process_commands(message)
at the end of the on_message
event (outside the if statement) and it should start working.
Read this for reference: https://discordpy.readthedocs.io/en/latest/faq.html#why-does-on-message-make-my-commands-stop-working
Answered By - Libby
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.