Giter VIP home page Giter VIP logo

yousefez / discord-qalib Goto Github PK

View Code? Open in Web Editor NEW
12.0 4.0 0.0 968 KB

๐Ÿ‘พ Discord library built on discord.py to simplify source code by rendering markup (xml) templates of embeds and menus (Pagination).

Home Page: https://yousefez.github.io/discord-qalib/

License: MIT License

Python 100.00%
discord discord-py python template-engine templates template templating templating-engine deserializer discord-menu

discord-qalib's Introduction

discord-qalib's People

Contributors

github-actions[bot] avatar yousefez avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

discord-qalib's Issues

๐Ÿ› Slash Commands with View Not Working

Offending code

async def respond(interaction):
    await interaction.response.send_message("Confirmed")
    
@bot.tree.command(name="button")
@qalib.qalib_interaction(formatter.Formatter(), "views.xml")
async def button(ctx: qalib.QalibInteraction[Views]):
    await ctx.rendered_send("test_key2", callables={"button1": respond})

discord.app_commands.errors.CommandInvokeError: Command 'button' raised an exception: TypeError: cannot pickle '_asyncio.Future' object

โœจ Add Files tag

add the optional files tag that can be placed in a message tag, and contains file tags

โœจ Add suppress_embeds tag

add the optional suppress_embeds tag that can be placed in a message tag, which has a default value of true

<suppress_embeds value="false"/>

โœจ Add Message Tag

Allow for a message tag that will contain all necessary elements for a message so this will include

  • content
  • tts
  • embed
  • embeds
  • file
  • files
  • nonce
  • delete_after
  • allowed_mentions
  • reference
  • mention_author
  • view
  • stickers
  • suppress_embeds

โœจ Add File tag

add the optional file tag that can be placed in a message tag, that takes the path of a file to upload

โœจ Expansive Menu

Having an expanding menu, based on the size of the single field, so if its larger than 1024 characters then it gets placed in a new embed, in a menu. Split on new line unless its double escaped "\n" seen as \n in the xml file.

<discord>
    <expansive page_number_key="%s" key="list">
        <embed>
            <title>This is a Expansive Embed %s</title>
            <colour>teal</colour>
            <expansive_field>
                <name>Name of the Field</name>
                <value>
                    This is the text
                    This is the second line
                </value>
            </expansive_text>
        </embed>
    </expansive>
</discord>

๐Ÿ› Listing Is Always Indented

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
basic example

<discord>
    <message key="random">
        <embed>
            <fields>
                <name>This is a field</name>
                <value>
                    __Details__:
                    - Item 1
                    - Item 2
                </value>
            </fields>
        </embed>
    </message>
</discord>

forms an embed with the Item 2 indented within Item 1
s.t.

  • Item 1
    • Item 2

Expected behavior
A clear and concise description of what you expected to happen.

for an embed with Item 2 to be underneath Item 1 not indented within it

  • Item 1
  • Item 2

Screenshots
If applicable, add screenshots to help explain your problem.

image

Server Platform (if relevant)

  • [ x] Windows
  • [ ] MacOS
  • [ ] Linux

Viewing Platform

  • [ x] Windows
  • [ x] MacOS
  • [ x] Linux
  • [ x] iOS
  • [ x] Android

โœจ Add allowed_mentions tag

add the optional allowed_mentions tag that can be placed in a message tag, that will contain the following optional tags

  • everyone <everyone mention="false"/>
  • users <users mention="false"/> , also you can pass a user child tag, which takes the id of the user.
<users>
    <user>324728364786234</user>
    <user>237489237988932</user>
</users>
  • roles <roles mention="false"/>, also you can pass a role child tag, which takes the id of the role.
<roles>
    <role>823784982348943</role>
    <role>128937128973494</role>
</roles>
  • replied_user <replied_user mention="false"/>

โœจ Add Reference tag

add the optional reference tag that can be placed in a message tag, which will construct a MessageReference instance based on the values provided. Requiring:

  • Message ID
  • Channel ID
  • Guild ID

and will look like this

<reference>
    <message_id>1062159023467663442</message_id>
    <channel_id>453257861166923787</channel_id>
    <guild_id>450807100575186955</guild_id>
</reference>

โœจ Add mention_author tag

add the optional mention_author tag that can be placed in a message tag. Defaults to false if it does not exist, and can be set

<mention_author value="false"/>

๐Ÿ› Expansive Embed not Splitting Pages Correctly

Describe the bug
A clear and concise description of what the bug is.
Expansive Embed does not take into account the title, or other static attributes of the menu, so it will always cross the threshold.

To Reproduce
Steps to reproduce the behavior:

  1. Submit template file causing the behavior
  2. Submit the code that you are using to run it
<discord>
    <expansive key="test">
        <title>Test Title</title>
        <colour>magenta</colour>
        <expansive_field>
            <name>Page</name>
            <value>{% for c in range(1024) %}c{% endfor %}</value>
        </expansive_field>
    </expansive>
</discord>

Expected behavior
A clear and concise description of what you expected to happen.
For the character count to be subtracted by static elements

Screenshots
If applicable, add screenshots to help explain your problem.

Server Platform (if relevant)

  • Windows
  • MacOS
  • Linux

Viewing Platform

  • Windows
  • MacOS
  • Linux
  • iOS
  • Android

Additional context
Add any other context about the problem here.

โœจ Add Stickers Tag

add the optional stickers tag that can be placed in a message tag, and contains sticker tags

<stickers>
    <sticker>237467832647823</sticker>
</stickers>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.