pycord-btns-menus
Package Name:A responsive package for Buttons, DropMenus and Combinations
• This module makes the process a lot easier !
Support Server for more guidance !
JoinFeatures:
1. Buttons
2. DropMenus
3. Combinations (Usage of both Buttons & DropMenus)
Installation
Python 3.6 or higher is required !
# Linux/macOS
python3 -m pip install -U pycord-btns-menus
# Windows
# Method-1:
py -3 -m pip install -U pycord-btns-menus
# Method-2:
pip install pycord-btns-menus
Note: Make sure to install py-cord package
Upgrading Package/ Module
# Linux/macOS
python3 -m pip uninstall pycord-btns-menus -y
python3 -m pip install pycord-btns-menus
# Windows
# Method-1:
py -3 -m pip uninstall pycord-btns-menus -y
py -3 -m pip install pycord-btns-menus
# Method-2:
pip uninstall pycord-btns-menus -y
pip install pycord-btns-menus
How to import module ?
# For buttons:
from btns_menus.Buttons import Button, DuoButton
# with this you can import specific Buttons
# or
from btns_menus.Buttons import *
# with this you can import all types of buttons
# For DropMenus:
from btns_menus.DropMenu import DropMenu, DuoDropMenu, BtnAndDropMenu
# with this you can import specific DropMenus
# or
from btns_menus.DropMenu import *
# with this you can import all types of DropMenus and Combinations
Sample Usage
Create a file with '.py ' extension, Like: main.py
from btns_menus.Buttons import *
from btns_menus.DropMenu import *
import discord
from discord.ext import commands
intents = discord.Intents.all()
client = commands.Bot(command_prefix="&", intents=intents)
@client.event
async def on_ready():
await client.change_presence(status=discord.Status.online, activity=discord.Game("&help - phoenix"))
print("Bot is Ready !")
@client.command()
async def test(ctx):
user = ctx.author
btn1 = SButton(label="Hello", response="Hello have a nice day !")
view_ = Button(user, btn1).view()
await ctx.send("click here !", view=view_)
if __name__ == "__main__":
client.run('token')
Example for Buttons:
Button type DuoButton , for more samples go to Examples/Buttons
@client.command()
async def test(ctx):
user: discord.Member = ctx.author
btn1 = SButton(label="Wave 👋", response=f"Hello {user.mention} have a nice day !")
btn2 = SButton(label="Bye", response=f"Bye {user.mention} see you later !", style=ButtonStyle.secondary)
view_ = DuoButton(user, btn1, btn2).view()
await ctx.send(f"Sample buttons ...", view=view_)
Preview:
Examples for DropMenus:
DropMenu type DuoDropMenu , for more samples go to Examples/DropMenus
@client.command()
async def test(ctx):
user: discord.Member = ctx.author
menu1 = SDropMenu(placeholder="select one", options=[
SelectOption(label="username"),
SelectOption(label="None of the above")
])
menu1.add_query(("username", f"username: {user.name}"))
menu2 = SDropMenu(placeholder="choose one", options=[
SelectOption(label="discriminator"),
SelectOption(label="None of the above")
])
menu2.add_query(("discriminator", f"discriminator: {user.discriminator}"))
view_ = DuoDropMenu(user, menu1, menu2).view()
await ctx.send(f"Sample buttons ...", view=view_)
Preview:
Buttons & DropMenus combination
• In this feature you can make & send Buttons and DropMenus together
Examples/combinations
• For more examples for mixture of btns & menus go toExamples for combinations
Usage of both Buttons and DropMenus at once ...
@client.command()
async def test(ctx):
user: discord.Member = ctx.author
btn1 = SButton(label="Delete Menu", style=ButtonStyle.danger, delete_msg=True)
menu1 = SDropMenu(placeholder="Select one", options=[
SelectOption(label="About Python", value="python")
])
menu1.add_query(("python", "Python is a widely-used, interpreted, object-oriented and"
" high-level programming language with dynamic semantics, used for general-purpose programming.\n"
"It was created by Guido van Rossum, and first released on February 20, 1991."))
view_ = BtnAndDropMenu(user, btn1, menu1).view()
await ctx.send(f"Sample buttons & Menus combinations ...", view=view_)
Preview:
Example for MultiButtons
Button type MultiButton , for more samples go to Examples/Buttons
The Process for MultiDropMenu will be the same ...
@client.command()
async def test(ctx):
user: discord.Member = ctx.author
user_avatar = user.display_avatar or user.default_avatar
btn1 = SButton(label="username", style=ButtonStyle.primary, response=user.name)
btn2 = SButton(label="discriminator", style=ButtonStyle.secondary, response=user.discriminator)
btn4 = SButton(label="Avatar", style=ButtonStyle.secondary, response=str(user_avatar), ephemeral=True)
btn3 = SButton(label="Server Name", style=ButtonStyle.secondary, response=user.guild.name)
btn5 = SButton(label="Display Name", style=ButtonStyle.secondary, response=user.display_name)
btn6 = SButton(label="Delete Menu", style=ButtonStyle.danger, delete_msg=True)
buttons = [btn1, btn2, btn3, btn4, btn5, btn6]
view_ = MultiButton(user, buttons).view()
await ctx.send(f"Sample Usage of Multi Buttons ...", view=view_)