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

Configure Feed

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

update messages

+19 -7
+3
kefi/config/__init__.py
··· 18 18 PLAZA_DEFAULT_MINUTE: int = 0 19 19 PLAZA_SIZE: int = 4 20 20 LOCALE: str = "es_ES" 21 + KUDOS_PRICE = 100 22 + CONGRATS_PRICE = 25 23 + HIGH_FIVE_PRICE = 5 21 24 22 25 class Config: 23 26 env_file = ".env"
+4 -3
kefi/models/kudos/helpers.py
··· 1 1 from sqlmodel import Session, select 2 2 3 + from kefi.config import settings 3 4 from kefi.constants import Command 4 5 from kefi.models.core.helpers import available_balance 5 6 from kefi.models.database import Action, Transaction, User ··· 12 13 actions: list[dict[str, int | str]] = [ 13 14 { 14 15 "keyword": Command.KUDOS, 15 - "amount": 100, 16 + "amount": settings.KUDOS_PRICE, 16 17 "header_template": "¡Gracias {receiver_name}!", 17 18 "message_template": "Mensaje de {sender_name}:\n _{message}_", 18 19 "context_template": "*{sender_name}* le da a *{receiver_name}* {amount} kefis.", ··· 21 22 }, 22 23 { 23 24 "keyword": Command.CONGRATS, 24 - "amount": 25, 25 + "amount": settings.CONGRATS_PRICE, 25 26 "header_template": "¡Enhorabuena {receiver_name}!", 26 27 "message_template": "Mensaje de {sender_name}:\n _{message}_", 27 28 "context_template": "*{sender_name}* le da a *{receiver_name}* {amount} kefis.", ··· 30 31 }, 31 32 { 32 33 "keyword": Command.HIGH_FIVE, 33 - "amount": 5, 34 + "amount": settings.HIGH_FIVE_PRICE, 34 35 "header_template": "¡{sender_name} le envía un high five a {receiver_name}!", 35 36 "message_template": "_{message}_", 36 37 "context_template": "*{sender_name}* le da a *{receiver_name}* {amount} kefis.",
+12 -4
kefi/routers/views.py
··· 43 43 alt_text="Kefi Plaza imagen", 44 44 ), 45 45 ), 46 + ContextBlock( 47 + elements=[ 48 + PlainTextObject( 49 + text=f"Al apuntarte consumirás {settings.PLAZA_PRICE} Kefis." 50 + ) 51 + ] 52 + ), 46 53 ], 47 54 ) 48 55 ··· 99 106 HeaderBlock(text=PlainTextObject(text="¡Gracias!")), 100 107 SectionBlock( 101 108 text=MarkdownTextObject( 102 - text="Hazle llegar tu agradecimiento a un compañero por ayudarte en un proyecto." 109 + text=f"Hazle llegar tu agradecimiento a un compañero por ayudarte en un proyecto.\nValor: {settings.KUDOS_PRICE} Kefis" 103 110 ), 104 111 accessory=ImageElement( 105 112 image_url="https://storage.staging.dekaside.com/kefi/static/images/kudos.png", ··· 113 120 HeaderBlock(text=PlainTextObject(text="¡Enhorabuena!")), 114 121 SectionBlock( 115 122 text=MarkdownTextObject( 116 - text="Un trabajo bien hecho, una buena idea, la certificación en un nuevo curso... ¡se merecen una enhorabuena!" 123 + text=f"Un trabajo bien hecho, una buena idea, la certificación en un nuevo curso... ¡se merecen una enhorabuena!\nValor: {settings.CONGRATS_PRICE} Kefis" 117 124 ), 118 125 accessory=ImageElement( 119 126 image_url="https://storage.staging.dekaside.com/kefi/static/images/congrats.png", ··· 127 134 HeaderBlock(text=PlainTextObject(text="¡High Five!")), 128 135 SectionBlock( 129 136 text=MarkdownTextObject( 130 - text="Alguien ha sido un buen colega y te ha alegrado el día." 137 + text=f"Alguien ha sido un buen colega y te ha alegrado el día.\nValor: {settings.HIGH_FIVE_PRICE} Kefis" 131 138 ), 132 139 accessory=ImageElement( 133 140 image_url="https://storage.staging.dekaside.com/kefi/static/images/highfive.png", ··· 141 148 HeaderBlock(text=PlainTextObject(text="Kefi Plaza")), 142 149 SectionBlock( 143 150 text=MarkdownTextObject( 144 - text=f"Cada viernes se asignan aleatoriamente grupos de {settings.PLAZA_SIZE} personas en una sala virtual para compartir un Kefi online y hablar de los que más os guste. ¿Te unes?" 151 + text=f"Cada viernes se asignan aleatoriamente grupos de {settings.PLAZA_SIZE} personas en una sala virtual para compartir un Kefi online y hablar de los que más os guste. ¿Te unes?\nCoste: {settings.PLAZA_PRICE} Kefis" 145 152 ), 146 153 accessory=ImageElement( 147 154 image_url="https://storage.staging.dekaside.com/kefi/static/images/kefi_plaza.png", ··· 153 160 ButtonElement( 154 161 text=PlainTextObject(text="¡Me Apunto!"), 155 162 action_id=Actions.SHOW_MEETS_MODAL, 163 + style="primary", 156 164 ) 157 165 ] 158 166 ),