 |
|

02.12.2022, 23:34
|
|
Познающий
Регистрация: 21.05.2020
Сообщений: 39
С нами:
3147962
Репутация:
8
|
|
Как исправить это?
bot discord:
Код:
import
discord
import
json
from
discord
.
ext
import
commands
file
=
open
(
'config.json'
,
'r'
)
config
=
json
.
load
(
file
)
bot
=
commands
.
Bot
(
command_prefix
=
config
[
'prefix'
]
)
@bot.command
(
name
=
'ping'
)
async
def
ping
(
ctx
)
:
await
ctx
.
send
(
f'{ctx.author.mention}pong'
)
bot
.
run
(
config
[
'token'
]
)
Сообщение от Спойлер
Traceback (most recent call last):
File "C:\Users\cawa1\Desktop\Discord Bot\main.py", line 9, in
bot = commands.Bot(command_prefix=config['prefix'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: BotBase.__init__() missing 1 required keyword-only argument: 'intents'

|
|
|

03.12.2022, 00:38
|
|
Участник форума
Регистрация: 21.12.2013
Сообщений: 181
С нами:
6522707
Репутация:
83
|
|
Как писал ранее, ДС не знаю. Но в новых версиях ДС, требуется intents
Попробуй:
Код:
Код:
# before
client = discord.Client()
# after
intents = discord.Intents.default()
client = discord.Client(intents=intents)
Источник
|
|
|

03.12.2022, 00:51
|
|
Познающий
Регистрация: 21.05.2020
Сообщений: 39
С нами:
3147962
Репутация:
8
|
|
|
|
|

03.12.2022, 00:53
|
|
Новичок
Регистрация: 19.07.2019
Сообщений: 21
С нами:
3590259
Репутация:
58
|
|
вместо intents = discord.Intents.default() попробуй intents = discord.Intents.all()
и лишний client тоже убери
|
|
|

03.12.2022, 01:02
|
|
Участник форума
Регистрация: 21.12.2013
Сообщений: 181
С нами:
6522707
Репутация:
83
|
|
Код:
Код:
import discord
import json
from discord.ext import commands
file = open('config.json', 'r')
config = json.load(file)
bot = commands.Bot(command_prefix=config['prefix'])
intents = discord.Intents.default()# или intents = discord.Intents.all()
client = discord.Client(intents=intents)
@bot.command(name='ping')
async def ping(ctx):
await ctx.send(f'{ctx.author.mention}pong')
bot.run(config['token'])
|
|
|

03.12.2022, 01:03
|
|
Познающий
Регистрация: 21.05.2020
Сообщений: 39
С нами:
3147962
Репутация:
8
|
|
|
|
|

03.12.2022, 01:08
|
|
Новичок
Регистрация: 19.07.2019
Сообщений: 21
С нами:
3590259
Репутация:
58
|
|
bot = commands.Bot(command_prefix=config['prefix'], intents=intents)
|
|
|

03.12.2022, 01:10
|
|
Познающий
Регистрация: 21.05.2020
Сообщений: 39
С нами:
3147962
Репутация:
8
|
|
|
|
|

03.12.2022, 01:11
|
|
Новичок
Регистрация: 19.07.2019
Сообщений: 21
С нами:
3590259
Репутация:
58
|
|
над этой строкой поставь intents = discord.Intents.all()
|
|
|

03.12.2022, 01:19
|
|
Познающий
Регистрация: 21.05.2020
Сообщений: 39
С нами:
3147962
Репутация:
8
|
|
Сообщение от Спойлер
2022-12-02 23:16:40 INFO discord.client logging in using static token
Traceback (most recent call last):
File "C:\Users\cawa1\Desktop\Discord Bot\main.py", line 19, in
bot.run(config['token'])
File "C:\Users\cawa1\AppData\Local\Programs\Python\Pyth on311\Lib\site-packages\discord\client.py", line 828, in run
asyncio.run(runner())
File "C:\Users\cawa1\AppData\Local\Programs\Python\Pyth on311\Lib\asyncio\runners.py", line 190, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "C:\Users\cawa1\AppData\Local\Programs\Python\Pyth on311\Lib\asyncio\runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\cawa1\AppData\Local\Programs\Python\Pyth on311\Lib\asyncio\base_events.py", line 650, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "C:\Users\cawa1\AppData\Local\Programs\Python\Pyth on311\Lib\site-packages\discord\client.py", line 817, in runner
await self.start(token, reconnect=reconnect)
File "C:\Users\cawa1\AppData\Local\Programs\Python\Pyth on311\Lib\site-packages\discord\client.py", line 746, in start
await self.connect(reconnect=reconnect)
File "C:\Users\cawa1\AppData\Local\Programs\Python\Pyth on311\Lib\site-packages\discord\client.py", line 672, in connect
raise PrivilegedIntentsRequired(exc.shard_id) from None
discord.errors.PrivilegedIntentsRequired: Shard ID None is requesting privileged intents that have not been explicitly enabled in the developer portal. It is recommended to go to https://discord.com/developers/applications/ and explicitly enable the privileged intents within your application's page. If this is not possible, then consider disabling the privileged intents instead.
Process finished with exit code 1
|
|
|
|
 |
|
|
Здесь присутствуют: 1 (пользователей: 0 , гостей: 1)
|
|
|
|