0
import discord
from discord.ext import commands
import asyncio

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

@client.event
async def on_message(message):
    if message.content.startswith("uno regeln"):
        await message.channel.send('http://www.uno-kartenspiel.de/spielregeln/')        

@client.command()
async def test(ctx):
    await ctx.send("Ok")
     
client.run("TOKEN")

When I try to run this and use -test nothing happens But why? I looked in the docs but in my opinion everything is fine

Sven Eberth
  • 3,057
  • 12
  • 24
  • 29
YES
  • 3
  • 4
  • 4
    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) – Łukasz Kwieciński Sep 10 '21 at 18:20

2 Answers2

0

As given by the link provided by @Lukasz Kwieciński, you need to change it to:

import discord
from discord.ext import commands
import asyncio

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

@client.event
async def on_message(message):
    if message.content.startswith("uno regeln"):
        await message.channel.send('http://www.uno-kartenspiel.de/spielregeln/')        
    await bot.process_commands(message)
@client.command()
async def test(ctx):
    await ctx.send("Ok")
     
client.run("TOKEN")
chess_lover_6
  • 632
  • 8
  • 22
-2
import discord
from discord.ext import commands

intents = discord.Intents.default()
client = commands.Bot(command_prefix="!", intents=intents)
client.remove_command('help')

@client.event
async def on_ready():
    print("Bot Is Ready")
    
    await client.change_presence(activity=discord.Game(name="TYPE THERE ANYONE"))

@client.command()
async def test(ctx):
    await ctx.send("Ok")

client.run('YOUR TOKEN')

Try this

Celavi
  • 1
  • 2
  • 1
    1) This doesn't answer the question at all & does other random stuff that is unrelated. 2) Instead of pasting a block of code in here, explain it a bit & explain **why** this fixes the issue. – stijndcl Sep 10 '21 at 21:32