Библиотека:
disnake==2.9.2
Code:
class nedopyskmodal(disnake.ui.Modal):
def __init__(self) -> None:
components = [disnake.ui.TextInput(label="Причина",placeholder="Правило по которой вы хотите выдать недопуск",custom_id="prison",style=disnake.TextInputStyle.short,min_length=1,max_length=500,),]
super().__init__(title="Причина недопуска", custom_id="create_tag", components=components)
async def callback(self, inter: disnake.ModalInteraction) -> None:
tag_reason = inter.text_values["prison"];uid = inter.author.id;id = alist[uid];guild = inter.guild
user = await guild.fetch_member(id)
embedvar = await defaultembed(f'Выдача недопуска',inter)
await inter.response.edit_message(embed=embedvar)
await user.remove_roles(get(guild.roles, name=config['noverifyrole']))
await user.add_roles(get(guild.roles, name=config['rolefornedopysk']))
Traceback (most recent call last):
File "C:\Users\MSI\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\disnake\ui\modal.py", line 208, in _scheduled_task
await self.callback(interaction)
File "f:\action\main.py", line 50, in callback
await user.remove_roles(get(guild.roles, id=config['noverifyrole']))
File "C:\Users\MSI\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\disnake\member.py", line 1082, in remove_roles
await req(guild_id, user_id, role.id, reason=reason)