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: text in notifications for all messages

seik 62d85e39 4d2c30d9

+17 -8
+1
kefi/models/database.py
··· 47 47 message_template: str = "" 48 48 context_template: str = "" 49 49 image: Optional[str] 50 + text: Optional[str] 50 51 51 52 52 53 class Transaction(SQLModel, table=True): # type: ignore
+1
kefi/models/outputs.py
··· 70 70 """Main response for Slack commands.""" 71 71 72 72 channel: Optional[str] 73 + text: Optional[str] 73 74 response_type: Optional[str] = "ephemeral" 74 75 blocks: List[Block]
+15 -8
kefi/routers/responses.py
··· 28 28 def __init__(self, message: str) -> None: 29 29 super().__init__() 30 30 section = Section(text=PlainText(text=message)) 31 - self.response = Response(blocks=[section]) 31 + self.response = Response(text=message, blocks=[section]) 32 32 33 33 34 34 class NotFoundResponse(SlackResponse): 35 35 def __init__(self) -> None: 36 36 super().__init__() 37 - section = Section(text=PlainText(text="Comando no encontrado")) 38 - self.response = Response(blocks=[section]) 37 + text = "Comando no encontrado" 38 + section = Section(text=PlainText(text=text)) 39 + self.response = Response(text=text, blocks=[section]) 39 40 40 41 41 42 class WalletResponse(SlackResponse): ··· 43 44 44 45 def __init__(self, user: User, remaining_amount: int, received_amount: int) -> None: 45 46 super().__init__() 47 + text = f"Pendiente gastar: {remaining_amount} / Recibidos: {received_amount}" 46 48 header = Header(text=PlainText(text=f"Cartera de {user.get_short_name()}")) 47 49 section = Section( 48 50 fields=[ ··· 54 56 alt_text="Mis Kefis", 55 57 ), 56 58 ) 57 - self.response = Response(blocks=[header, section]) 59 + self.response = Response(text=text, blocks=[header, section]) 58 60 59 61 60 62 class ActionResponse(SlackResponse): ··· 124 126 ] 125 127 ) 126 128 ) 127 - self.response = Response(response_type=self.response_type, blocks=blocks) 129 + self.response = Response( 130 + text=self.action.text, response_type=self.response_type, blocks=blocks 131 + ) 128 132 129 133 130 134 class DepositResponse(SlackResponse): 131 135 def __init__(self, amount: int) -> None: 132 136 super().__init__() 137 + text = f"¡Buenas noticias! Acabamos de ingresar {amount} kefis en tu cartera" 133 138 section = Section( 134 139 text=MarkDown( 135 - text=f"*¡Buenas noticias!* \n Acabamos de ingresar {amount} kefis en tu cartera." 140 + text=f"*¡Buenas noticias!* \n Acabamos de ingresar {amount} kefis en tu cartera" 136 141 ) 137 142 ) 138 - self.response = Response(blocks=[section]) 143 + self.response = Response(text=text, blocks=[section]) 139 144 140 145 141 146 class HelpResponse(SlackResponse): 142 147 def __init__(self) -> None: 143 148 super().__init__() 149 + text = "¡Hola, soy Kefi!" 144 150 first_header = Header(text=PlainText(text="Enviar agradecimientos")) 145 151 first_section = Section( 146 152 text=MarkDown( ··· 165 171 ) 166 172 ) 167 173 self.response = Response( 168 - blocks=[first_header, first_section, second_header, second_section] 174 + text=text, 175 + blocks=[first_header, first_section, second_header, second_section], 169 176 )