Y
Y
yuckemsi2021-10-28 11:54:32
Python
yuckemsi, 2021-10-28 11:54:32

Why is the discord bot not responding to the command?

I have a bot with this code

import asyncio
import random
import discord
from discord.ext import commands

intents = discord.Intents.all()

client = commands.Bot(command_prefix='!', intents=intents)

@client.event
async def on_ready():
    print('Бот уже попущенный')
w1 = [0,1,0,0,0,1] #(можешь еще добавить, сколько душе угодно(0, 2, 3, 4... - Не даст роль, 1 - даст роль))

@client.command()
async def chest(message):
    if message.channel != 903198062963490827:
        return
    if message.author == py.user: # (проверка на сообщение от бота(игнорируем))
        return
    w2 = random.choice(w1)
    if w2 == 1:
        guild = message.guild
        channel = message.channel
        user = message.author # (чисто для удобства упрощаем вид)
        await channel.send('ТЫ ПОПАЛ В ПОДВАЛ, ХА-ХА-ХА')
    if w2 == 0:
        await channel.send('нюхай')
        await asyncio.sleep(120)

client.run('')


Why is he not responding to the command?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Killir Vanya229, 2021-11-04
@yuckemsi

In async def chest(message): there should be a ctx parameter instead of message (i.e. async def chest(ctx):)
And also replace everything from message to ctx in the command code

Y
yuckemsi, 2021-12-05
@yuckemsi

not working xD

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question