Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

223
Vistas
How can I make a bot that listens for events but also has commands in discord?

I need my discord bot to listen for events and I need it to have commands. Here is an example of my problem

import os
from keepalive import keep_alive
from discord.ext import commands

client = commands.Bot(command_prefix = "$")

banned_words = [
"blah", "blahh", "blahhh"
]

@client.event
async def on_message(message):

    msg = message.content
    msgsend = message.channel.send

    if any(word in msg.lower() for word in banned_words):
        await message.channel.purge(limit=1)
        await msgsend("Please don't use banned words!")

@client.command()
async def dice(message, amount:int):
    await message.channel.send("blah blah blah")
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Add await client.process_commands(message) at the beggining of your on_message event. This code process commands and allow users to invoke/use them.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda