I want to output the modal menu through the button and embed, but it gives an error that disnake did not understand the lable of the button, tell me how to fix and output the menu through the button. I also want to know how to add reactions to the embed something like voting. I tried to do it but it gives an error.
import disnake
from disnake.ext import commands
from disnake import TextInputStyle, Button, ButtonStyle, ActionRow
from config import settings
bot = commands.Bot(command_prefix="!", intents= disnake.Intents.all(), activity=
disnake.Game('game',))
bot.remove_command('help')
@bot.event
async def on_ready():
print(f'Вы вошли как {bot.user}')
@bot.command()
@commands.has_role(IDROLE)
async def support(ctx):
emb = disnake.Embed(color = 0x71368a, title = 'title',
description =
f"""
**description**
""",
colour = 0x71368a
)
rowA = ActionRow(
Button(style = ButtonStyle.green, label = 'button', emoji = '', custom_id =
'button_button')
)
await ctx.send(embed = emb, components = [rowA])
@bot.event
async def on_button_click(inter):
class MyModal(disnake.ui.Modal):
def __init__(self):
components = [
disnake.ui.TextInput(
label="ЧЕГО БУДЕТ КОСАТЬСЯ ВАШЕ ПРЕДЛОЖЕНИЕ?",
placeholder="Сервер, бот, игра.",
custom_id="ЧЕГО БУДЕТ КОСАТЬСЯ ВАШЕ ПРЕДЛОЖЕНИЕ?",
style=TextInputStyle.short,
min_length=3,
max_length=50,
),
disnake.ui.TextInput(
label="ОПИШИТЕ ВАШЕ ПРЕДЛОЖЕНИЕ",
placeholder="Wow",
custom_id="Описание",
style=TextInputStyle.short,
max_length=2000,
),
disnake.ui.TextInput(
label="ЧЕМ ВАШЕ ПРЕДЛОЖЕНИЕ БУДЕТ ПОЛЕЗНО ИГРОКАМ",
placeholder="wow",
custom_id="Чем идея будет полезна",
style=TextInputStyle.short,
max_length=2000,
),
]
super().__init__(
title="Новое предложение",
custom_id="create_tag",
components=components,
)
async def callback(self, inter: disnake.ModalInteraction):
embed = disnake.Embed(title="```Спасибо за предложение!```", color =0x00FF9A )
embed.set_author(name = f"{inter.author.name}" ,icon_url= f"{inter.author.avatar}")
for key, value in inter.text_values.items():
embed.add_field(
name=key.capitalize(),
value=value[:1024],
inline=False,
)
await inter.response.send_message(embed=embed)
@bot.event
async def on_member_join(member):
role = member.guild.get_role(IDROLE)
await member.add_roles(role)
bot.run(settings['TOKEN'])
ERROR:
ImportError: cannot import name 'InvalidArgument' from 'discord' (C:\Users\PC\AppData\Local\Programs\Python\Python310\lib\site-packages\discord_init_.py)