Slash Commands
Slash Command registrieren
python
@bot.slash_command(description='Zeigt die Latenz des Bots')
async def ping(ctx):
await ctx.send('Pong! 🏓')Wird mit /ping aufgerufen.
Mit Argumenten
python
@bot.slash_command(description='Sagt etwas')
async def say(ctx, text):
await ctx.send(text)Aufruf: /say: Hallo Welt
Buttons
python
import nexcord
@bot.command()
async def vote(ctx):
yes_btn = nexcord.Button(label='✅ Ja', style=nexcord.Button.SUCCESS)
no_btn = nexcord.Button(label='❌ Nein', style=nexcord.Button.DANGER)
@yes_btn.callback
async def on_yes(interaction):
await ctx.send('Du hast Ja gewählt!')
@no_btn.callback
async def on_no(interaction):
await ctx.send('Du hast Nein gewählt!')
await ctx.send('Wie findest du Nexcord?', buttons=[yes_btn, no_btn])Button Styles
| Style | Beschreibung |
|---|---|
Button.PRIMARY | Blau |
Button.SUCCESS | Grün |
Button.DANGER | Rot |
Button.WARNING | Gelb |
