Skip to main content

Package Name: discord-btns-menus

A responsive package for Buttons, DropMenus, Combinations and Paginator

• This module makes the process a lot easier !

python badge

CodeQL Generic badge Github License Windows Linux

GitHub stars GitHub forks GitHub issues

Join Official Discord Server for more guidance !


Key Features

  • Buttons
  • DropMenus
  • Combinations (Usage of both Buttons & DropMenus)
  • Paginator Generic badge

  • Installation

    Python 3.8 or higher is required !

    # Linux/macOS
      python3 -m pip install discord-btns-menus
    
    # Windows
      # Method-1:
        py -3 -m pip install discord-btns-menus
        # or
        python -m pip install discord-btns-menus
      # Method-2:
        pip install discord-btns-menus
    
    # Using GIT for ALPHA or BETA Versions
      # Method-1:
        pip install git+https://github.com/Modern-Realm/discord_btns_menus.git
      # Method-2:
        pip install -U git+https://github.com/Modern-Realm/discord_btns_menus
    

    REQUIRED DEPENDENCIES

    You can use ANY ONE of the below Package

    Note: Don't install more than one DEPENDENCY !


    Sample Usage

    Create a file with '.py ' extension, Like: main.py

    from btns_menus.Buttons import SButton, SingleButton
    from btns_menus.DropMenus import SDropMenu, DuoDropMenu
    from btns_menus.Combinations import BtnAndDropMenu, MultiBtnAndMenu
    
    import discord
    from discord.ext import commands
    
    intents = discord.Intents.all()
    activity = discord.Game("&help - phoenix")
    
    client = commands.Bot(command_prefix="&", intents=intents, activity=activity)
    
    
    @client.event
    async def on_ready():
        await client.change_presence(status=discord.Status.online)
        print("Bot is Ready !")
    
    
    @client.command()
    async def test(ctx):
        user = ctx.author
    
        btn1 = SButton(label="Hello", response="Hello have a nice day !")
    
        view_ = SingleButton(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:

    Button-Samples.gif


    Examples for DropMenus:

    DropMenu type DuoDropMenu, for more samples go to Examples/DropMenuss

    @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:

    DropMenu-Samples.gif


    Buttons & DropMenus combination

    • In this feature you can make & send Buttons and DropMenus together
    • For more examples for mixture of btns & menus go to Examples/combinations

    Examples 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:

    Sample-Combinations.gif


    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_)
    

    Preview:

    Sample-Combinations.gif


    Example for Paginator

    Generic badge

    It is used for help commands which sends the embeds like page-wise using buttons & Drop Menus

    from btns_menus.Paginator import *
    from datetime import datetime
    import discord
    
    
    # This function is for sample purposes, use discord.Embed instead [RECOMMENDED]
    def embed(context: str, color=0xffff00, timestamp: bool = False) -> discord.Embed:
        present_time = datetime.utcnow() if timestamp else None
        em = discord.Embed(description=context, color=discord.Color(color), timestamp=present_time)
        return em
    
    
    @client.command()
    async def help(ctx):
        user = ctx.author
    
        embeds = [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()
        await ctx.send(embed=embeds[0], view=view_)
    

    Sample-Combinations.gif


    Project Links

    You can get support/help/guidance from below social-media links


    Metadata

    Release files for discord-btns-menus 0.2.6

    For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

    Source distribution (sdist)

    Source distribution for discord-btns-menus 0.2.6
    File Size Uploaded Provenance Actions
    discord-btns-menus-0.2.6.tar.gz 19.6 kB Without provenance Details for discord-btns-menus-0.2.6.tar.gz

    Built distribution (wheel)

    Table of built distributions (wheels) for discord-btns-menus 0.2.6
    File Interpreter ABI Platform Actions
    discord_btns_menus-0.2.6-py3-none-any.whl Python 3 none any Details for discord_btns_menus-0.2.6-py3-none-any.whl

    Total release size: 40.7 kB

    Release files / discord-btns-menus-0.2.6.tar.gz

    Download URL discord-btns-menus-0.2.6.tar.gz
    Size 19.6 kB
    Tags Source
    SHA-256 checksum
    How to use checksums
    caeb8e84461615790d202aae5a90e02a3f508af705a3b4e729aca0c77c5a1b1a
    BLAKE2b-256 checksum
    How to use checksums
    f5836719950c169d7a031726de473cddaa2d149c5ff247e8732be2263a479626
    Upload date
    Uploaded using Trusted Publishing?
    What is trusted publishing?
    No
    Uploaded via twine/4.0.1 CPython/3.11.0

    Release files / discord_btns_menus-0.2.6-py3-none-any.whl

    Download URL discord_btns_menus-0.2.6-py3-none-any.whl
    Size 21.1 kB
    Tags Python 3
    SHA-256 checksum
    How to use checksums
    1e0f08196ce01c87f6d7980fd938047716f1e41f485d94275cbbcb93de8636b3
    BLAKE2b-256 checksum
    How to use checksums
    7bd738eb88e943fb9102bde6bc52296d34590c8b9847841b5dc31def12fd6f15
    Upload date
    Uploaded using Trusted Publishing?
    What is trusted publishing?
    No
    Uploaded via twine/4.0.1 CPython/3.11.0

    Security for discord-btns-menus 0.2.6

    Provenance

    Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

    No provenance found

    None of the files in this release were uploaded with provenance metadata.

    A note on package security

    PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

    To learn more about protecting yourself from malicious actors, visit our package security documentation.

    Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page