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

Configure Feed

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

Merge pull request #5 from Dekalabs/feat/api-call-groups

feat: api call groups

authored by

Marcos Gabarda and committed by
GitHub
cd738f02 f48c9ea6

+36 -3
kefi/models/plaza/__init__.py

This is a binary file and will not be displayed.

+5
kefi/models/plaza/helpers.py
··· 1 + import uuid 2 + 3 + 4 + def generate_random_meet() -> str: 5 + return f"http://g.co/meet/kefi-plaza-{str(uuid.uuid4())}"
+30
kefi/slack.py
··· 1 + import uuid 1 2 from collections.abc import Sequence 2 3 3 4 from slack_sdk.web.client import WebClient ··· 43 44 self, user_id: str, blocks: Sequence[dict], text: str | None = None 44 45 ): 45 46 self.client.chat_postMessage(channel=user_id, blocks=blocks, text=text) 47 + 48 + def create_group_call( 49 + self, url: str, users: Sequence[str], external_unique_id: str | None = None 50 + ): 51 + external_unique_id = external_unique_id or str(uuid.uuid4()) 52 + response = self.client.calls_add( 53 + external_unique_id=external_unique_id, join_url=url 54 + ) 55 + call_id = response["call"]["id"] 56 + self.add_to_group(users, call_id) 57 + return self.client.calls_info(id=call_id)["call"] 58 + 59 + def add_to_group(self, users: Sequence[str], call_id: str): 60 + self.client.calls_participants_add( 61 + id=call_id, users=[{"slack_id": user} for user in users] 62 + ) 63 + 64 + def notify_call(self, users: Sequence[str], call_id: str): 65 + chat_notify: Sequence[dict[str, str]] = [ 66 + { 67 + "type": "call", 68 + "call_id": call_id, 69 + } 70 + ] 71 + for user in users: 72 + self.client.chat_postMessage(channel=user, blocks=chat_notify) 73 + 74 + def end_call(self, call_id: str): 75 + self.client.calls_end(id=call_id)
+1 -3
manage.py
··· 1 1 #!/usr/bin/env python 2 - from typing import Dict 3 - 4 2 from IPython import start_ipython 5 3 6 4 7 - def kefi_namespace() -> Dict: 5 + def kefi_namespace() -> dict: 8 6 """Defines a dict with the scope to use in the shell. By default we add: 9 7 - Models 10 8 - Session