Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update embeds.py #1284

Closed
wants to merge 1 commit into from
Closed

Update embeds.py #1284

wants to merge 1 commit into from

Conversation

4gpp
Copy link

@4gpp 4gpp commented Feb 3, 2025

Summary

I have PR because as a bot developer myself I spend a lot of repetitive time typing "inline = False" for embeds. This change allows it to be done naturally as I have discovered with most embeds it is 78.2% more likely ( yes i did use a calculator 😭) to be an False bool rather than True. This change is only made for QOL I have tested on my own pc and with my own bot currently running this change and it works fine if you do inline=True to put it inline and if nothing is there it is automatically False.

Checklist

  • [ x] If code changes were made, then they have been tested
    • [ x] I have updated the documentation to reflect the changes
    • [] I have formatted the code properly by running pdm lint
    • I have type-checked the code by running pdm pyright
  • This PR fixes an issue
  • [ x] This PR adds something new (e.g. new method or parameters)
  • This PR is a breaking change (e.g. methods or parameters removed/renamed)
  • This PR is not a code change (e.g. documentation, README, ...)

Signed-off-by: 4GP <[email protected]>
@Skelmis
Copy link
Contributor

Skelmis commented Feb 4, 2025

As an aside you could create your own embed class which inherits from disnakes embed and sets your preferred defaults.

@shiftinv
Copy link
Member

shiftinv commented Feb 5, 2025

This would be a breaking change; there are no plans to change this right now.
As @Skelmis mentioned, the intended solution would be to subclass the library's Embed class, adjust the defaults however you like, and use that subclass in your code in its place:

class MyEmbed(disnake.Embed):
    # `inline` default changed to false
    def add_field(self, name: Any, value: Any, *, inline: bool = False):
        return super().add_field(name, value, inline=inline)

    ...

embed = MyEmbed(...)
embed.add_field("a", "b")  # inline defaults to false, now

@shiftinv shiftinv closed this Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants