Recently added these strings to my bot:
@client.command(pass_context= True) @commands.has_permissions(administrator= True) async def clear(ctx, amount= 100): await ctx.channel.purge(limit= amount)
and the bot stopped working. I tried to remove this part and try to figure it out further, but it did not help. The bot did not stop working, but stopped responding to commands. If the bot sees a word from its dictionary, then it calmly reacts to it, but it stopped responding to commands. There are no errors in the console.
I give the full version of the code:
#import import discord; from discord.ext import commands #command_prefix client= commands.Bot(command_prefix= "$") #dicts coord_dict= ["cords", "base", "where is the base", "coordinates", "coords of the base", "coords", "base", "where is base", "koordinati", "kordi", "kords" , "koords", "cords", "coords", "base coordinates"] #coonect_info @client.event async def on_ready(): print("HOORAY I COMPILED! Hurray<WITH SATAN COME") #hello_command @client.command(pass_context= True) async def hello(ctx): await ctx.send (f"Hi (here is the nickname of the person who entered the command)!\n\nI am bot-helper, which can you say to you all, what do you want about clan.\n\nHello, (here too)!\n\nI'm a bot that will say all the news of the clan that I know and that you want!\n\nPrint: $help to show my commands!\nEnter $help for a list of available commands!") #NOTE TO YOURSELF: DON'T FORGET TO IMPLEMENT THE IDEA WITH THE MENTION IN #hello_command!!!! #coords_command @client.command(pass_context= True) async def coords(ctx): await ctx.send("Coords: test\nCoords: zero zero 0. Coords: zero zero null") #on_message checker @client.event async def on_message(message): msg= message.content.lower() if msg in coord_dict: await message.channel.send("zero zero 0") #clear_command @client.command(pass_context= True) @commands.has_permissions(administrator= True) async def clear(ctx, amount= 100): await ctx.channel.purge(limit= amount) connect token= open("token.txt", 'r').readline() client.run(token)
Answer # 1
Standard trouble with the on_message event, everyone stumbles, so in the official FAQ this answer is even the first item:
- python : Self bot, permanent connection to the voice channel
- python : Bot not sending message to PM (Discord.py)
- python : How to implement the mute discord.py command?
- python : The bot does not find the command
- How to make a discord bot command only work if a person is in voice chat (python)
- python : bot ignores arguments
- python : How to set an avatar?
- python : Discord music bot
- Can't start python discord bot