diff --git a/setup.py b/setup.py index 9140e62..c327052 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ setup( name="tc-messageBroker", - version="1.6.3", + version="1.6.4", author="Mohammad Amin Dadgar, RnDAO", maintainer="Mohammad Amin Dadgar", maintainer_email="dadgaramin96@gmail.com", diff --git a/tc_messageBroker/rabbit_mq/payload/payload_microservices.py b/tc_messageBroker/rabbit_mq/payload/payload_microservices.py index 02828ae..71637d1 100644 --- a/tc_messageBroker/rabbit_mq/payload/payload_microservices.py +++ b/tc_messageBroker/rabbit_mq/payload/payload_microservices.py @@ -1,21 +1,19 @@ -from .discord_bot.base_types.interaction_callback_data import InteractionCallbackData from .discord_bot.chat_input_interaction import ChatInputCommandInteraction from .discord_bot.create_followup_message_data import FollowUpMessageData from .discord_bot.edit_webhook_data import InteractionResponseEditData +from .discord_bot.interaction_response import InteractionResponse class DiscordBotInteractionResponseCreatePayload: def __init__( self, - type: int, - data: InteractionCallbackData | None = None, interaction: ChatInputCommandInteraction | None = None, + data: InteractionResponse | None = None, ) -> None: """ to set right values please refer to https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response """ - self.type = type self.data = data self.interaction = interaction @@ -23,25 +21,20 @@ def __init__( def from_dict(cls, d: dict) -> "DiscordBotInteractionResponseCreatePayload": interaction = d.get("interaction") data = d.get("data") - type = d.get("type") if interaction is not None: interaction = ChatInputCommandInteraction.from_dict(interaction) if data is not None: - data = InteractionCallbackData.from_dict(data) - - if type is not None: - type = int(type) + data = InteractionResponse.from_dict(data) return cls( - type=type, data=data, interaction=interaction, ) def to_dict(self): - return {"type": self.type, "data": self.data, "interaction": self.interaction} + return {"data": self.data.to_dict(), "interaction": self.interaction} class DiscordBotInteractionResponseEditPayload: