This repository was archived by the owner on Mar 8, 2022. It is now read-only.
Releases: discord-py-ui/discord-ui
Releases · discord-py-ui/discord-ui
v5.1.6 - fix
5.1.5 (yes, anpther fix)
5.1.4 FIX
5.1.3 - fix (again 💀)
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
https://pypi.org/project/discord-ui/5.1.2/
Fixed
commands.nukenot 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 `
Fixed
KeyError: '!globals'
v5.1.0 - upgrade
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_idcomes now afteroptions
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_commandandSlash.edit_subcommand, "moved" toCommand.edit SlashedCommandis nowSlashInteraction,SlashedSubCommandis nowSubSlashInteractionandSlashedContextis nowContextInteraction- The command attributes of CommandInteractions (SlashedCommand, ...) are now moved to
Interaction.command.(the.commandattribute 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
.paramattribute is now.target
Changed
argument_typein SlashOption is nowtypeButtonStylevalue names changed: color names are now capitalized andDangeris nowDestructiveListener.target_useris nowListener.target_usersand can take users, members and ids as the valueBaseCommand.optionsandSlashOption.optionsis now of typeSlashOptionCollection, 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.pymodule into a folder on_button_pressandon_menu_selectis nowon_buttonandon_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.Botinstances wouldn't get overriden which lead to not enabling needed debug events - when no matching component listener in
Listenercould be found, the events for components events wouldn't be dispatched delete_afterkeyword in message send override not working- mentionable type in slashoptions not being parsed to objects
@discord.ext.commands.Cooldownnot working on cog slashcommands
Added
**fieldsto all functions that edit the message components (like.disable_components,.disable_component, ...). The**fieldsparameter can be used to edit other properties of the message without using.editagain and send a "useless" request@Lister.on_errorand@Listener.wrong_userdecorators for handling Exceptions in Listeners- When no keyword was passed to
@Listener.buttonor@Listener.select, the function will be called on every button/slect channel_typeto SlashOption, list ofdiscord.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.
Mentionabletype 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
\u200bwhich 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()idto SlashCommandcommands_syncedevent which will be dispatched when all commands where synced with the api (UI.Slash.sync_commands)BaseCommmand.updatemethod which updates the api command with the lcoal changesSlashSubCommand.base, which will be shared among all subslashcommands with the same base
5.0.2 - print
5.0.1 - fix
v5 - autocompletion
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.Permissionsbut 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_generatorkeyword andautocompletekeyword.
autocompleteis not needed if you pass choice_generatorNote 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