I'm trying to make a Discord Bot for my server and I'm trying to make it so if u say .help the bot will show you a Dropdown Menu and you can select things like "Support", "Staff application" and more but I have no idea how to send specific messages. Here's exactly what I want to do:
User: ".help"
Bot: Sends dropdown menu
User: Selects #1 (Support)
Bot: Sends Message one; "How can we help you?"
User: *Responds with "Someone just called me bad names!"
Bot: "Okay"
Here's the full code:
import nextcord
from nextcord.ext import commands
import asyncio
intents = nextcord.Intents().all()
bot = commands.Bot(command_prefix=".", intents=intents)
bot.remove_command('help')
@bot.event
async def on_ready():
print("bereit")
q_list = [
'Wie lautet dein Steam name?',
'Was ist dein Alter?',
'In welchem Land lebst du zurzeit?',
'Was ist deine Timezone?',
'Besitzt du ein funktionierendes Mikrofon?',
'Kennst du dich mit Supporten aus?',
'Wie lange spielst du schon auf Polizei FivePD?',
'Wieso willst du in unser team?',
'Hast du dich jemals bei uns beworben?',
'Kennst du unsere regeln?',
'Wurdest du schonmal gebannt?',
'Bist du zurzeit in einem anderem Team Aktiv?',
'Was sind deine Hobbys?',
'Was sind deine Stärken und Schwächen?',
'Warum sollten wir dich über andere nehmen?',
'Schlusswort.'
] #The questions for staff application
a_list = [] #Answers of staff application will be saved here
class MyView(nextcord.ui.View):
@nextcord.ui.select(
placeholder="Wähle eine Kategorie!",
min_values=1,
max_values=1,
options=[
nextcord.SelectOption(
label="#1",
description="Kreiere eine neue Bewerbung.", #Staff application
value="1"
),
nextcord.SelectOption(
label="#2",
description="Support Ticket.", #Support
value="2"
),
nextcord.SelectOption(
label="#3",
description="Spieler Report.", #Player Report
value="3"
),
nextcord.SelectOption(
label="#4",
description="Einen Entbann oder Unmute beantragen.", #Apply unmute or ban
value="4"
),
]
)
async def select_callback(self, select, interaction):
if select.values[0] == 1:
await interaction.response.send_message("test")
#await interaction.response.send_message(f"Du hast {select.values[0]} genommen!")
@bot.command(aliases=['help'])
async def hilfe(ctx):
aembed = nextcord.Embed(description="**Bitte wähle eine Kategorie.**")
await ctx.send(embed=aembed, view=MyView()) #||||This is the message with the dropdown menu!||||
a_list = []
submit_channel = bot.get_channel(917569655139348543)
channel = await ctx.author.create_dm()
def check(m):
return m.content is not None and m.channel == channel and m.author == ctx.author
for question in q_list:
await asyncio.sleep(.5)
await channel.send(question)
msg = await bot.wait_for('message', check=check)
a_list.append(msg.content)
submit_wait = True
while submit_wait:
await channel.send('Das wars. Bitte sende "fertig" um es abzusenden.')
msg = await bot.wait_for('message', check=check)
if "fertig" in msg.content.lower():
submit_wait = False
answers = "\n".join(f'{a}. {b}' for a, b in enumerate(a_list, 1))
embed=nextcord.Embed(description=f"**Bewerbung von {msg.author}.\n\n**Hier sind die antworten:\n{answers}")
await submit_channel.send(embed=embed) #This sends the answers of the Staff application into a channel