Skip to content
This repository has been archived by the owner on Mar 8, 2022. It is now read-only.

Releases: discord-py-ui/discord-ui

v5.1.6 - fix

19 Dec 20:42
Compare
Choose a tag to compare

https://pypi.org/project/discord-ui/5.1.6/

Fixed

  • guild_permissions not being applied

5.1.5 (yes, anpther fix)

12 Dec 17:18
Compare
Choose a tag to compare

5.1.4 FIX

12 Dec 14:29
Compare
Choose a tag to compare

5.1.3 - fix (again 💀)

12 Dec 14:12
Compare
Choose a tag to compare

https://pypi.org/project/discord-ui/5.1.3/

Fixed

  • ButtonInteraction has no attribute 'custom_id'
  • Component listeners not being called

v5.1.2 - Fix

10 Dec 07:01
Compare
Choose a tag to compare

https://pypi.org/project/discord-ui/5.1.2/

Fixed

  • commands.nuke not working
  • nextcord import issues (#112 + some more)
  • command comparing: commands won't get edited anymore if there were no changes

v5.1.1 - fix `KeyError `

27 Nov 19:22
Compare
Choose a tag to compare

Fixed

  • KeyError: '!globals'

v5.1.0 - upgrade

27 Nov 16:47
Compare
Choose a tag to compare

https://pypi.org/project/discord-ui/5.1.0/

Breaking changes

  • Component custom ids are now optional, if no custom id is passed, a 100 characters long random string will be used and because of that the order of Component init params changed
  • The order of SelectMenus init params changed, custom_id comes now after options
SelectMenu("my_custom_id", [options...here])
# is now
SelectMenu([options...here], "my_custom_id")
  • Same for Buttons
Button("my_custom_id", "label")
# is now
Button("label", "my_custom_id")
  • ButtonStyles is now ButtonStyle
  • renamed cog decorators, the old ones still work but they will show a deprecation warning: slash_command -> slash_command, subslash_command -> subslash_command, context_cog -> context_command, listening_component -> listening_component
  • Removed Slash.edit_command and Slash.edit_subcommand, "moved" to Command.edit
  • SlashedCommand is now SlashInteraction, SlashedSubCommand is now SubSlashInteraction and SlashedContext is now ContextInteraction
  • The command attributes of CommandInteractions (SlashedCommand, ...) are now moved to Interaction.command. (the .command attribute is a reference to the real command, if you change properties of the command they will be updated)
  • The component attributes of an interaction are now moved to .component
  • ContextCommands .param attribute is now .target

Changed

  • argument_type in SlashOption is now type
  • ButtonStyle value names changed: color names are now capitalized and Danger is now Destructive
  • Listener.target_user is now Listener.target_users and can take users, members and ids as the value
  • BaseCommand.options and SlashOption.options is now of type SlashOptionCollection, which allows you to acces options by index and name
my_command.options["option name"]
# or
my_command.options[0]

You can also use some methods like .get, .set (which will return itself after it set something, so SlashOption.set(key, value).set(key, value) would work) and SlashOption.options + SlashOption.option will add both SlashOptions together

  • If an invalid guild id was passed to a slashcommand, no exception will be raised anymore, it will just be printed into the console and ignored logging.error()
  • Moved the discord_ui.ext.py module into a folder
  • on_button_press and on_menu_select is now on_button and on_select. The old event names will still work but will be removed in the next release

Fixed

  • disable_action_row
  • ActionRow.disable
  • no interaction events being dispatched because subclasses of dpy2 commands.Bot instances wouldn't get overriden which lead to not enabling needed debug events
  • when no matching component listener in Listener could be found, the events for components events wouldn't be dispatched
  • delete_after keyword in message send override not working
  • mentionable type in slashoptions not being parsed to objects
  • @discord.ext.commands.Cooldown not working on cog slashcommands

Added

  • **fields to all functions that edit the message components (like .disable_components, .disable_component, ...). The **fields parameter can be used to edit other properties of the message without using .edit again and send a "useless" request
  • @Lister.on_error and @Listener.wrong_user decorators for handling Exceptions in Listeners
  • When no keyword was passed to @Listener.button or @Listener.select, the function will be called on every button/slect
  • channel_type to SlashOption, list of discord.ChannelType. This will restrict the shown channels for channel slash options to this list.
  • support for nextcord. Other libs should work too, but they are not tested.
  • Mentionable type for SlashOptions
  • description for short slashoptions. If you set the options for a slash command via callback params, you can add a description (and a type) to them with your docstring. There are 3 different styles you can use:
# style 1
@ui.slash.command()
async def my_command(ctx, my_option, my_other_option):
    """This is my command description

    my_option: `int`:
        This is the description for the my_option parameter
    my_other_option: `str`:
        This is the description for another option
    """
    ...

# style 2
@ui.slash.command()
async def my_command(ctx, my_option: int, my_other_option: str):
    """This is my command description

    my_option: This is the description for the my_option parameter
    my_other_option: This is the description for another option
    """
    ...

# style 3
@ui.slash.command()
async def my_command(ctx, my_option, my_other_option: str):
    """This is my command description


    `int`: This is the description for the my_option parameter

    This is the description for another option
    """
    ...

Note: You don't have to use `type`, you can just use type

  • Empty descriptions for slashcommands and slashoptions. The default description value is now \u200b which is an "empty" char
  • Modifying slashcommand options is now WWAAYYYY easier. You can just do .options[name or index].name = "new name" and the option will be updated
  • You can set the autocomplete choice generator with a decorator now
ui.slash.command(options=[SlashOption(str, "my_option")])
async def my_command(ctx, my_option):
    ...


@my_command.options["my_option"].autocomplete_function
async def my_generator(ctx):
    ...
# or
@my_command.options[0].autocomplete_function
async def my_generator(ctx):
    ...
  • All apllication command decorators will now return the created Command
@ui.slash.command(...)
async my_command(ctx):
    ...
type(my_command) # SlashCommand
  • Added edit and delete method to slashcommand. You can use this for editing or deleting the command later
# edit
await my_command.edit(name="test")
# delete
await my_command.delete()
  • id to SlashCommand
  • commands_synced event which will be dispatched when all commands where synced with the api (UI.Slash.sync_commands)
  • BaseCommmand.update method which updates the api command with the lcoal changes
  • SlashSubCommand.base, which will be shared among all subslashcommands with the same base

5.0.2 - print

25 Sep 17:47
Compare
Choose a tag to compare

5.0.1 - fix

23 Sep 17:17
Compare
Choose a tag to compare

v5 - autocompletion

23 Sep 13:25
Compare
Choose a tag to compare

https://pypi.org/project/discord-ui/5.0.0

Fixed

  • Roles not being parsed correctly

Changed

  • default_permission

default_permission can now be of type discord.Permissions but the api doesn't support that yet. Documentation reference.

  • slash http

some code changes to slash-http features

Added

  • ChoiceGeneratorContext

Context class for choice generation

  • SlashOption

choice_generator keyword and autocomplete keyword.
autocomplete is not needed if you pass choice_generator

Note that the autocompletion is currently limited to desktop clients

  • File sending

You are now able to send hidden files

Note

Some of the features mentioned above are not finished in the api yet, so there can occur some issues