aboutsummaryrefslogtreecommitdiff
path: root/src/botnet.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/botnet.py')
-rw-r--r--src/botnet.py42
1 files changed, 2 insertions, 40 deletions
diff --git a/src/botnet.py b/src/botnet.py
index 086d01f..377c0c2 100644
--- a/src/botnet.py
+++ b/src/botnet.py
@@ -1,4 +1,5 @@
from .db import create_deployment, get_daily_user_deployment_count, get_deployment, update_deployment_status, get_active_users, get_user, add_deployment_message, get_deployment_messages
+from .utils import generate_voting_blocks
from slack_sdk.web.async_client import AsyncWebClient
import os
from dotenv import load_dotenv
@@ -90,46 +91,7 @@ async def deploy_message(user_id: str, message: str):
deployment_id = await create_deployment(user_id, message)
- 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: 0\n> Reject: 0"
- }
- },
- {
- "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}"
- }
- ]
- }
- ]
+ blocks = generate_voting_blocks(deployment_id, message, 0, 0, True)
client = AsyncWebClient(token=selfbot_token)
response = await client.chat_postMessage(