anonimusanonimosovich
@anonimusanonimosovich

Как исправить ошибку?

При запуске бота происходит ошибка:
TypeError: __init__() missing 1 required keyword-only argument: 'intents'

код бота:
import discord
from discord.ext import commands

try:
    with open('token.txt', 'r') as f:
        token = f.read()
except:
    with open('token.txt', 'w+') as f:
        print('Ведите токен в файл')
        input()
else:
    print('подключение')               
 
administrators = []
prefix = 't$'

bot = commands.Bot(command_prefix=prefix)

@bot.event
async def on_ready():
    print('я готов работать')
    await bot.change_presence(activity=discord.Game(name=f'{prefix}help'))
@bot.command()
async def embed(ctx):
    embed = discord.Embed(
     title = 'msg',
     description = 'msg',
    )
    await ctx.send(embed=embed)
    
@bot.command()
async def msg(ctx, arg):
    if arg == 'test':
        await ctx.send('TEST')
        await ctx.message.delete()


@bot.command()
async def chcreate(ctx, count):
    if int(ctx.author.id) in administrators:
        for i in range (int(count)):
            create = 0
            try:
                await ctx.guild.create_text_channel('для видео :)')
                await ctx.message.add_reaction('✔️')
            except:
                print('Канал не был создан') 
            else:
                create+=1
                embed = discord.Embed(
                  title = 'канал успешно создан',
                  description = ' как дела?) ',
                )
                await ctx.author.send(embed=embed),    
                client = discord.Client(intents=discord.Intents.default())
                                    

bot.run(token)
  • Вопрос задан
  • 101 просмотр
Пригласить эксперта
Ответы на вопрос 2
Vindicar
@Vindicar
RTFM!
Вместо того, чтобы копировать код с замшелых гайдов, читай документацию. По ссылке как раз про это, и с примерами кода.
Ответ написан
Комментировать
Wolf_Yout
@Wolf_Yout
bot = commands.Bot(command_prefix="your prefix", intents=discord.Intents.all()

На сайте Discord Developers включи все интенты.
Ответ написан
Комментировать
Ваш ответ на вопрос

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

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