Код:
@bot.slash_command(description="test")
async def test(inter):
author_id = inter.author.id
p_c_id = sql.execute("SELECT party_creator_id FROM bets WHERE party_user_id = ?", (author_id, )).fetchone()
users = sql.execute("SELECT party_user_id FROM bets WHERE party_creator_id = ?", (p_c_id[0], )).fetchall()
print(users)
for member in users:
user = client.get_user(member[0])
await user.send('msg')
Ошибка:
Ignoring exception in slash command 'test':
Traceback (most recent call last):
File "C:\Users\Ayzat\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\ext\commands\slash_core.py", line 732, in invoke
await call_param_func(self.callback, inter, self.cog, **kwargs)
File "C:\Users\Ayzat\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\ext\commands\params.py", line 1022, in call_param_func
return await maybe_coroutine(safe_call, function, **kwargs)
File "C:\Users\Ayzat\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\utils.py", line 600, in maybe_coroutine
return await value
File "C:\Users\Ayzat\PycharmProjects\JustABot v2\bot.py", line 644, in test
await user.send('msg')
AttributeError: 'NoneType' object has no attribute 'send'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Ayzat\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\ext\commands\interaction_bot_base.py", line 1377, in process_application_commands
await app_command.invoke(interaction)
File "C:\Users\Ayzat\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\ext\commands\slash_core.py", line 741, in invoke
raise CommandInvokeError(exc) from exc
disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'send'
если что,
users = [('546745471264227329',), ('483893889955004427',)]
я хочу что бы всем людям из таблицы в ЛС пришло сообщение