- 190
- 133
Проблема в том, что бот на команду "#rand" реагирует не только как на команду, но и как на обычный текст. Мне надо чтобы бот реагировал на команду только как на команду и игнорировал её как текст.
не обращайте внимание на никнеймы... локальные приколы, ничего более
main:
import discord
import random
from discord.ext import commands
config = {
'token': '',
'prefix': '#',
}
intents = discord.Intents.default()
intents.presences = True
intents.members = True
intents.message_content = True
bot = commands.Bot(command_prefix=config['prefix'], intents = intents)
@bot.command()
async def rand(ctx):
await ctx.reply(random.randint(0, 100))
@bot.event
async def on_message(ctx):
await bot.process_commands(ctx)
if ctx.author != bot.user:
if ctx.channel.name == "bot-test":
await ctx.reply('Ты ' + ctx.channel.name)
bot.run(config['token'])
![e041d.png](/proxy.php?image=https%3A%2F%2Fi.stack.imgur.com%2Fe041d.png&hash=cb7f48750480934c5cb1e3026766f852)
не обращайте внимание на никнеймы... локальные приколы, ничего более