-1

I have code like this:

@bot.command(pass_context=True)
@commands.has_any_role(admin, moderator, ghostluko)
async def ver(ctx,member:discord.Member = None):
    role = ctx.guild.get_role(role_id=868210259284619324)
    role1 = ctx.guild.get_role(role_id=905358001270046770)
    await ctx.message.delete()
    await member.add_roles(role)
    await member.remove_roles(role1)
    await ctx.send(f'{member} дал роль "{role}"') 

after I add this, other commands start do not work

@bot.event
async def on_message(message):

    embedbotreply = discord.Embed(description = f"Напишите help для подробной информации. Ваш префикс: {bot.command_prefix}", color = 0x8147fc)

    if bot.user.mentioned_in(message):
        await message.channel.send(embed = embedbotreply)

@bot.command()
async def ping(ctx):

    embedping = discord.Embed(description = f" Мой пинг: {format(round(bot.latency, 1))} ms!", color = 0x8147fc)

    await ctx.send(embed = embedping)
    await ctx.message.delete()

Also, on_member_join do not work. I don't know what to do.

Maron
  • 9
  • 1
  • 1
    Does this answer your question? [Why does on\_message stop commands from working?](https://stackoverflow.com/questions/49331096/why-does-on-message-stop-commands-from-working) – Benjin Nov 19 '21 at 09:30

1 Answers1

0
 @bot.event
 async def on_message(message):
      if message.author==bot.user: 
        return

      await bot.process_commands(message)

Try using await bot.process_commands(message) in your code and after this code you can use your other commands :

import discord
from discord.ext import commands

bot = commands.Bot(command_prefix="!")


@bot.event
async def on_ready():
  print('We are logged in!')

@bot.event
async def on_message(message):
   if message.author==bot.user: 
     return

   await bot.process_commands(message)

@bot.command()
async def ping(message) :
   await message.channel.send("Pong!!")

bot.run("TOKEN")

Hope, this helps you !!