Package: discord-btns-menus
Package Name:discord-btns-menusA responsive package for Buttons, DropMenus, Combinations and Paginator• This module makes the process a lot easier !JoinOfficial Discord Serverfor more guidance !Key FeaturesButtonsDropMenusCombinations (Usage of both Buttons & DropMenus)PaginatorInstallationPython 3.8 or higher is required !# Linux/macOSpython3-mpipinstalldiscord-btns-menus# Windows# Method-1:py-3-mpipinstalldiscord-btns-menus# orpython-mpipinstalldiscord-btns-menus# Method-2:pipinstalldiscord-btns-menus# Using GIT for ALPHA or BETA Versions# Method-1:pipinstallgit+https://github.com/Modern-Realm/discord_btns_menus.git# Method-2:pipinstall-Ugit+https://github.com/Modern-Realm/discord_btns_menusREQUIRED DEPENDENCIESYou can use ANY ONE of the below Packagepy-cordnextcorddiscord.pyV2.0disnakeFor disnake you should Refactor all discord terms to disnake terms to make Package workNote:Don't install more than oneDEPENDENCY !Sample UsageCreate a file with '.py ' extension, Like:main.pyfrombtns_menus.ButtonsimportSButton,SingleButtonfrombtns_menus.DropMenusimportSDropMenu,DuoDropMenufrombtns_menus.CombinationsimportBtnAndDropMenu,MultiBtnAndMenuimportdiscordfromdiscord.extimportcommandsintents=discord.Intents.all()activity=discord.Game("&help - phoenix")client=commands.Bot(command_prefix="&",intents=intents,activity=activity)@client.eventasyncdefon_ready():awaitclient.change_presence(status=discord.Status.online)print("Bot is Ready !")@client.command()asyncdeftest(ctx):user=ctx.authorbtn1=SButton(label="Hello",response="Hello have a nice day !")view_=SingleButton(user,btn1).view()awaitctx.send("click here !",view=view_)if__name__=="__main__":client.run('token')Example for Buttons:Button typeDuoButton, for more
samples go toExamples/Buttons@client.command()asyncdeftest(ctx):user:discord.Member=ctx.authorbtn1=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()awaitctx.send(f"Sample buttons ...",view=view_)Preview:Examples for DropMenus:DropMenu typeDuoDropMenu, for
more samples go toExamples/DropMenuss@client.command()asyncdeftest(ctx):user:discord.Member=ctx.authormenu1=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()awaitctx.send(f"Sample buttons ...",view=view_)Preview:Buttons & DropMenus combination• In this feature you can make & send Buttons and DropMenus together• For more examples for mixture of btns & menus go toExamples/combinationsExamples for combinationsUsage of both Buttons and DropMenus at once ...@client.command()asyncdeftest(ctx):user:discord.Member=ctx.authorbtn1=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()awaitctx.send(f"Sample buttons & Menus combinations ...",view=view_)Preview:Example for MultiButtonsButton typeMultiButton, for
more samples go toExamples/ButtonsThe Process
forMultiDropMenuwill be the same ...@client.command()asyncdeftest(ctx):user:discord.Member=ctx.authoruser_avatar=user.display_avataroruser.default_avatarbtn1=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()awaitctx.send(f"Sample Usage of Multi Buttons ...",view=view_)Preview:Example for PaginatorIt is used for help commands which sends the embeds like page-wise using buttons & Drop Menusfrombtns_menus.Paginatorimport*fromdatetimeimportdatetimeimportdiscord# This function is for sample purposes, use discord.Embed instead [RECOMMENDED]defembed(context:str,color=0xffff00,timestamp:bool=False)->discord.Embed:present_time=datetime.utcnow()iftimestampelseNoneem=discord.Embed(description=context,color=discord.Color(color),timestamp=present_time)returnem@client.command()asyncdefhelp(ctx):user=ctx.authorembeds=[embed("embed-1"),embed("embed-2"),embed("embed-3"),embed("embed-4"),embed("embed-5"),embed("embed-6")]cmd_list=[SOption(name="moderation",embed_=embeds[1]),SOption(name="giveaways",embed_=embeds[2]),SOption(name="links",embed_=embeds[3])]view_=Paginator(user,embeds,commands_list=cmd_list).view()awaitctx.send(embed=embeds[0],view=view_)Project LinksYou can get support/help/guidance from below social-media linksHome PageOfficial Discord ServerPyPi PackageDocumentation