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

Commit

Permalink
Update 0.1.1
Browse files Browse the repository at this point in the history
Added `discord-interactions` callback
  • Loading branch information
Damego committed Oct 28, 2021
1 parent b32f9a0 commit a5fe116
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions discord_slash_components_bridge/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,21 @@

class SlashCommand(_SlashCommand):
_components_callback = {}


async def _on_component(self, to_use):
ctx = ComponentContext(self.req, to_use, self._discord, self.logger)
self._discord.dispatch("component", ctx)

# discord-interactions callback
callback = self.get_component_callback(
ctx.origin_message_id, ctx.custom_id, ctx.component_type
)
if callback is not None:
self._discord.dispatch("component_callback", ctx, callback)
await self.invoke_component_callback(callback, ctx)

# discord-components callback
if self._components_callback.get(ctx.custom_id):
callback_info = self._components_callback[ctx.custom_id]
if callback_info["uses"] == 0:
Expand Down
2 changes: 1 addition & 1 deletion discord_slash_components_bridge/const.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.1.0"
__version__ = "0.1.1"

0 comments on commit a5fe116

Please sign in to comment.