I'm trying to make SelectMenu to give out roles on the server I need to make it infinite, but I don't understand how. And besides, the one I wrote does not give out roles. I already third day sit with this error, and do not understand what is wrong. Bot does not even show what the error, the console is empty. here is the code. What do I have to do to make it work as intended?
@client.command()
async def sm(inter):
view =None
if inter.author.id == 1012357055987851345:
await inter.send('Text',
components = [
Select(
placeholder = 'Выберете роль',
options = [
SelectOption(label="Роль", value="Девушка"),
SelectOption(label="Роль2", value="Rainbow"),
])])
interaction = await client.wait_for("select_option")
selected = interaction.values[0]
if selected == "Роль":
user = inter.author
role = client.get_role(1029824401878810624)
await inter.user.add_roles(role)
await inter.send("Роли выданы")
if selected == "Роль2":
await user.add_roles(role)
await inter.send("Роли выданы")
And if you can, show me the working version as an example.
imports:
from msilib.schema import Component
from optparse import Option
import discord
from discord.ui import Select, View
import json
import os
import random
import asyncio
import aiohttp
from discord.ext import commands
from dislash import slash_commands
from discord_slash import SlashCommand
from discord_slash import SlashContext
import discord_components
from discord_components import DiscordComponents, Select, SelectOption, Button, ButtonStyle
from discord_components import *
maybe you can use discord.py2, it worked for me