Search code examples
pythondiscord.pybotframework

Doesn't seem like my command is working in Discord.py


The command is executed, although the terminal says the command doesn't exist. Not sure what's up as this is my first discord bot, I know a little bit of python, so I am sorry for taking up your guys's time, really.

Thank you for the help though!

import discord
from discord.ext import commands


bot = commands.Bot(command_prefix= ':')
game = discord.Game("with the API")
#list of banned words
filtered_words = ['bad words']
@bot.event
async def on_ready():
    print("Hello I am online and ready!")

bot.run('token')

#Group message clearing
@bot.command(aliases=['c'])
@commands.has_permissions(manage_messages = True)
async def clear(ctx, amount=1):
        await ctx.channel.purge(Limit = amount)
        await ctx.reply(f'Deleted {clear} messages')

#auto mod
@bot.event
async def on_message(msg):
    for word in filtered_words:
        if word in msg.context:
            await msg.delete()
    await bot.process_commands(msg)

@bot.event
async def on_disconnect():
    print("I seem to be getting disconnected, one minute!")

@bot.event
async def on_member_join(memeber):
    print(f'Weclome {memeber} to the server, please enjoy your stay!')

@bot.event
async def on_message_delete(msg):
    msg.send(" <:raysQ:835686467844964395> ")

Solution

  • The bot.run part should be at the end of the file. It's.the entry point to the loop.

    Also please regenerate your token before someone else can use it.