nnnLik
@nnnLik
Capybara god

Почему не могу установить префикс боту discord.py?

import discord
from discord.ext import commands

config = {
    'token': 'your-token',
    'prefix': 'prefix',
}

bot = commands.Bot(command_prefix=config['prefix'])


@bot.event
async def on_message(ctx):
    if ctx.author != bot.user:
        await ctx.reply(ctx.content)

Я в первый раз делаю бот для дс. Настрочил что-то такого и оно выдает ошибку

Traceback (most recent call last):
File "E:\project\Toster\main.py", line 9, in
bot = commands.Bot(command_prefix=config['prefix'])
TypeError: BotBase.__init__() missing 1 required keyword-only argument: 'intents'


и пайчарм выделяет последнюю скобку, на строке где присваиваю префикс
  • Вопрос задан
  • 813 просмотров
Пригласить эксперта
Ответы на вопрос 1
Progger228
@Progger228
Нужно добавить intents
intents = discord.Intents.default()
intents.presences = True
intents.members = True 
intents.message_content = True

bot = commands.Bot(command_prefix=config['prefix'], intents = intents)
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы