Добрового дня / вечера, столкнулся с проблемой модуля discord-ui.
Сам код:
import discord
from discord.ext import commands
from discord_ui import UI ,Components, Button, SelectMenu, SelectOption
client = commands.Bot (command_prefix=PREFIX, intents = discord.Intents.all(), case_insensitive=True)
ui = UI(client)
@client.command( pass_context=True )
@client.listen()
async def on_message( message ):
if message.content == '!Button':
await ui.components.send( message.channel, '**Поддержка**', components=[
Button( 'Начать чат', 'my_custom_id', 'green' ),
Button( 'Меню', 'my_custom_id', 'black' ),
SelectMenu(options=[
SelectOption('Чат')
], custom_id='another_custom_id', placeholder='Выберите тип поддержки' )
] )
Ошибка:
Traceback (most recent call last):
File "\OneDrive\Рабочий стол\RIMOбот\RIMO.py", line 7, in
from discord_ui import UI ,components, Button, SelectMenu, SelectOption
File "\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord_ui\__init__.py", line 34, in
from .client import *
File "\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord_ui\client.py", line 1, in
from .cogs import BaseCallable, InteractionableCog, ListeningComponent
File "\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord_ui\cogs.py", line 5, in
from .slash.types import BaseCommand, ContextCommand, MessageCommand, SlashCommand, SlashSubcommand, UserCommand
File "\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord_ui\slash\__init__.py", line 20, in
from . import ext
File "\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord_ui\slash\ext\__init__.py", line 13, in
from .builder import *
File "\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord_ui\slash\ext\builder.py", line 2, in
from ...enums import CommandType, OptionType
File "\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord_ui\enums.py", line 13, in
discord.StoreChannel,
^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'discord' has no attribute 'StoreChannel'. Did you mean: 'StageChannel'?