简体   繁体   中英

Discord.py: How do you make buttons?

I was wondering how you can get buttons like this

在此处输入图像描述

Thats how you create an send them:

menu_buttons = await ctx.send(
    "Nickmenu",
    components=[
        [
            Button(
                label="Purge!", custom_id="purge", style=ButtonStyle.red, emoji="🚫"
            ),
            Button(
                label="Raid!", custom_id="raid", style=ButtonStyle.green, emoji="🌍"
            ),
            Button(
                label="Check!",
                custom_id="check",
                style=ButtonStyle.green,
                emoji="✅",
            ),
        ]
    ],
)

I used the discord components library for this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM