Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import discord
- from discord.ui import Select, View
- from discord.ext.commands.context import Context
- from discord.ext import commands
- intents = discord.Intents.all()
- bot = commands.Bot(intents=intents, command_prefix="*")
- TOKEN = ""
- @bot.event
- async def on_ready():
- name_bot = bot.user.name
- print(f"{'-'*45}\nDiscord Bot ist online als {name_bot}\n{'-'*45}")
- @bot.command(name="message")
- async def send_message(ctx: Context):
- select = Select(
- min_values=1,
- max_values=4,
- placeholder="Suche deine Rolle aus",
- options=[
- discord.SelectOption(label="Gamer", emoji="🎮",
- description="Eine Rolle für Gamer"),
- discord.SelectOption(label="Student", emoji="👨🎓",
- description="Eine Rolle für Studenten"),
- discord.SelectOption(label="Gamer_2", emoji="🎮",
- description="Eine Rolle für Gamer"),
- discord.SelectOption(label="Student_2", emoji="👨🎓",
- description="Eine Rolle für Studenten")
- ])
- async def my_callback(interaction):
- await interaction.response.send_message(f"Deine Auswahl ist: {select.values}")
- select.callback = my_callback
- view = View()
- view.add_item(select)
- await ctx.send("Suche eine Rolle aus", view=view)
- bot.run(TOKEN)
Advertisement
Add Comment
Please, Sign In to add comment