aboutsummaryrefslogtreecommitdiff
path: root/src/utils.py
diff options
context:
space:
mode:
authorArslaan Pathan <[email protected]>2026-07-16 19:37:14 +1200
committerArslaan Pathan <[email protected]>2026-07-16 19:37:14 +1200
commitc2a74e7472beace631fcab24986d83326e4c5dd7 (patch)
treed710c8dfb865b9f0b4377c75bac2ff5847de1923 /src/utils.py
parente93169c11c848f78d0411031ae2589e9d5b1fde0 (diff)
downloadslack-botnet-c2a74e7472beace631fcab24986d83326e4c5dd7.tar.xz
slack-botnet-c2a74e7472beace631fcab24986d83326e4c5dd7.zip
Almost done with voting!!
Diffstat (limited to 'src/utils.py')
-rw-r--r--src/utils.py45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/utils.py b/src/utils.py
new file mode 100644
index 0000000..1efc693
--- /dev/null
+++ b/src/utils.py
@@ -0,0 +1,45 @@
+def generate_voting_blocks(deployment_id: int, message: str, approve_count: int, reject_count: int, voting_enabled: bool):
+ blocks = [
+ {
+ "type": "header",
+ "text": {
+ "type": "plain_text",
+ "text": f"Voting | Deployment #{deployment_id}"
+ }
+ },
+ {
+ "type": "section",
+ "text": {
+ "type": "mrkdwn",
+ "text": f"*Message:*\n> {message}"
+ }
+ },
+ {
+ "type": "section",
+ "text": {
+ "type": "mrkdwn",
+ "text": f"*Votes:*\n> Approve: {approve_count}\n> Reject: {reject_count}"
+ }
+ },
+ ]
+
+ if voting_enabled:
+ blocks.append({
+ "type": "actions",
+ "elements": [
+ {
+ "type": "button",
+ "text": {"type": "plain_text", "text": "Approve ^_^"},
+ "style": "primary",
+ "action_id": f"vote_approve_{deployment_id}"
+ },
+ {
+ "type": "button",
+ "text": {"type": "plain_text", "text": "Reject T_T"},
+ "style": "danger",
+ "action_id": f"vote_reject_{deployment_id}"
+ }
+ ]
+ })
+
+ return blocks