Ошибка Exception has occurred: TypeError при запуске дискорд бота (python)

Рейтинг: 0Ответов: 1Опубликовано: 05.03.2023

При запуске дискорд бота вылезает ошибка Exception has occurred: TypeError BotBase.__init__() missing 1 required keyword-only argument: 'intents'.

import discord
import asyncio
from discord.ext import commands
from datetime import datetime
from discord import app_commands
from config_file import settings

bot = commands.Bot(command_prefix = settings['prefix'])
intents = discord.Intents.default()
intents.message_content = True
client = discord.Client(intents=intents)
tree = app_commands.CommandTree(client)

@client.event
async def on_ready():
    print('Loading...')
    print('Client is loaded. Please enter password for autorization and launch bot: ')
    print(f'Welcome {client.user}! Bot had launched')
    print("""Aviable commands (temporaly disabled): 
        /meslog - display of messages from users
        /stats - display all settings and statics about bot""")

Пробовал делать вот так, но ошибка никуда не пропала:

import discord
import asyncio
from discord.ext import commands
from datetime import datetime
from discord import app_commands
from config_file import settings

bot = discord.Client(intents=discord.Intents.default()), commands.Bot(command_prefix = settings['prefix'])

@bot.event
async def on_ready():[![введите сюда описание изображения][1]][1]
    print('Loading...')
    print('Client is loaded. Please enter password for autorization and launch bot: ')
    print(f'Welcome {client.user}! Bot had launched')
    print("""Aviable commands (temporaly disabled): 
        /meslog - display of messages from users
        /stats - display all settings and statics about bot""")

Заранее спасибо за помощь

Ответы

▲ 0Принят

Измените строку:

bot = discord.Client(intents=discord.Intents.default()), commands.Bot(command_prefix = settings['prefix'])

На эту:

bot = commands.Bot(command_prefix=settings['prefix'], intents=discord.Intents.default())

Так же включить Intents на сайте. Пример здесь.