When I run this command nothing appears… No error, no message, nothing. I’ve tried making this a @client.command() but that didn’t help. What am I doing wrong?
This is my code:
@client.event
async def on_message(help):
if help.content == "meow help":
help = discord.Embed( title = 'Oh? You need some Help?', description = 'Bot prefix is "meow". If a Command has- Bot Prefix is not Necessary. Heres a list of possible commands and their uses:', color=0x00ff00 )
help.add_field(name='Meow 4 me', value='I say nyaa~!', inline=True)
await ctx.reply(embed=help)
print("Help is wanted")
I have little experience with python not to mention the no experience with any packages to make a discord bot in python but what is ctx in the line above the print statement?
Hi @yas I would suggest using the discord.py command handler instead of doing it yourself with the on message event. That would result in your code looking something like this:
import os
import discord
from discord.ext import commands
client = commands.Bot(command_prefix='meow', help_command=None, case_insensitive=True)
@client.command()
async def help(ctx):
help = discord.Embed( title = 'Oh? You need some Help?', description = 'Bot prefix is "meow". If a Command has- Bot Prefix is not Necessary. Heres a list of possible commands and their uses:', color=0x00ff00 )
help.add_field(name='Meow 4 me', value='I say nyaa~!', inline=True)
await ctx.reply(embed=help)
print("Help is wanted")
# Other commands here
# ...
# ...
client.run(os.getenv('token'))
Hey guys, thank you for all the helpful comments, I figured out that it was a different command overriding it (@client.event async def on_message which scans through all sent messages)