Python backend for a Slack's kudos plugin.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(actions): add leave meet action

+30 -1
+29 -1
kefi/routers/helpers.py
··· 4 4 5 5 from sqlmodel import Session 6 6 7 - from kefi.constants import Command, InteractionType 7 + from kefi.constants import Actions, Command, InteractionType 8 8 from kefi.dependencies import InteractionParams, SlashCommandParams 9 9 from kefi.models.core.exceptions import NotEnoughKefi 10 10 from kefi.models.core.helpers import ( ··· 16 16 received_balance, 17 17 send_admin_amount, 18 18 ) 19 + from kefi.models.database import User 19 20 from kefi.models.kudos.helpers import ( 20 21 get_action, 21 22 notify_receiver_user_chat_action, ··· 199 200 return [] 200 201 201 202 def interaction_block_actions(self) -> list: 203 + actions = self.payload["actions"] 204 + if actions is not None: 205 + for action in actions: 206 + ActionsHandler(action=action, session=self.session, user=self.user) 207 + 202 208 return [] 203 209 204 210 def _view_submission_meet_join(self, view_id: str) -> list | dict: ··· 263 269 264 270 def not_found(self) -> list: 265 271 return [] 272 + 273 + 274 + class ActionsHandler: 275 + def __init__(self, action: dict, session: Session, user: User): 276 + self.action = action 277 + self.session = session 278 + self.user = user 279 + self.slack = Slack() 280 + 281 + def response(self) -> SlackResponse: 282 + handlers: dict[str, Callable] = { 283 + Actions.LEAVE_MEET: self.action_leave_meet, 284 + } 285 + action_id = self.action["action_id"] 286 + response = handlers.get(action_id, self.not_found)() 287 + return response 288 + 289 + def action_leave_meet(self): 290 + ... 291 + 292 + def not_found(self): 293 + ...
+1
kefi/routers/interactivity.py
··· 14 14 ): 15 15 """Calls the interaction handler and gets the response.""" 16 16 interaction_handler = InteractionHandler(interaction=interaction, session=session) 17 + print(interaction.payload) 17 18 return interaction_handler.response()