mirror of
https://github.com/MichaByte/OnBoard-Live.git
synced 2025-12-06 07:13:41 -05:00
wip changes
This commit is contained in:
parent
34da8cebda
commit
8cf027d67a
1 changed files with 79 additions and 4 deletions
|
|
@ -83,17 +83,92 @@ def handle_app_home_opened_events(body, logger, event, client):
|
||||||
@bolt.view("apply")
|
@bolt.view("apply")
|
||||||
def handle_application_submission(ack, body):
|
def handle_application_submission(ack, body):
|
||||||
ack()
|
ack()
|
||||||
print(body)
|
user = body["user"]["id"]
|
||||||
convo = bolt.client.conversations_open(users=body["user"]["id"], return_im=True)
|
sumbitter_convo = bolt.client.conversations_open(users=user, return_im=True)
|
||||||
|
user_verified = (
|
||||||
|
"Eligible L" not
|
||||||
|
in requests.get(
|
||||||
|
"https://verify.hackclub.dev/api/status", json={"slack_id": user}
|
||||||
|
).text
|
||||||
|
)
|
||||||
bolt.client.chat_postMessage(
|
bolt.client.chat_postMessage(
|
||||||
channel=convo["channel"]["id"], text=f"Your application has been submitted! We will review it shortly. Please do not send another application - If you haven't heard back in over 48 hours, message @mra! Here's a copy of your responses for your reference:\n{body['view']['state']['values']['project-info']['project-desc-value']['value']}"
|
channel=sumbitter_convo["channel"]["id"],
|
||||||
|
text=f"Your application has been submitted! We will review it shortly. Please do not send another application - If you haven't heard back in over 48 hours, or you forgot something in your application, please message <@{os.environ['ADMIN_SLACK_ID']}>! Here's a copy of your responses for your reference:\nSome info on your project(s): {body['view']['state']['values']['project-info']['project-desc-value']['value']}{f"\nPlease fill out <https://forms.hackclub.com/eligibility?program=Onboard%20Live&slack_id={user}|the verification form>! We can't approve your application until this is done." if not user_verified else ""}",
|
||||||
|
)
|
||||||
|
admin_convo = bolt.client.conversations_open(
|
||||||
|
users=os.environ["ADMIN_SLACK_ID"], return_im=True
|
||||||
|
)
|
||||||
|
bolt.client.chat_postMessage(
|
||||||
|
channel=admin_convo["channel"]["id"],
|
||||||
|
text=":siren-real: New OnBoard Live application! :siren-real:",
|
||||||
|
blocks=[
|
||||||
|
{
|
||||||
|
"type": "section",
|
||||||
|
"text": {
|
||||||
|
"type": "mrkdwn",
|
||||||
|
"text": ":siren-real: New OnBoard Live application! :siren-real:",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "section",
|
||||||
|
"text": {
|
||||||
|
"type": "plain_text",
|
||||||
|
"text": f":technologist: Name: SUB_ME",
|
||||||
|
"emoji": True,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "section",
|
||||||
|
"text": {
|
||||||
|
"type": "plain_text",
|
||||||
|
"text": f":white_check_mark: Is verified: {user_verified}",
|
||||||
|
"emoji": True,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "section",
|
||||||
|
"text": {
|
||||||
|
"type": "plain_text",
|
||||||
|
"text": f":hammer_and_wrench: Will make: {body['view']['state']['values']['project-info']['project-desc-value']['value']}",
|
||||||
|
"emoji": True,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "section",
|
||||||
|
"text": {
|
||||||
|
"type": "plain_text",
|
||||||
|
"text": f":pray: Will behave on stream: Yes",
|
||||||
|
"emoji": True,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "actions",
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"type": "button",
|
||||||
|
"text": {
|
||||||
|
"type": "plain_text",
|
||||||
|
"emoji": True,
|
||||||
|
"text": "Approve",
|
||||||
|
},
|
||||||
|
"style": "primary",
|
||||||
|
"value": "deny",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "button",
|
||||||
|
"text": {"type": "plain_text", "emoji": True, "text": "Deny"},
|
||||||
|
"style": "danger",
|
||||||
|
"value": "approve",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@bolt.command("/onboard-live-apply")
|
@bolt.command("/onboard-live-apply")
|
||||||
def apply(ack: Ack, command):
|
def apply(ack: Ack, command):
|
||||||
ack()
|
ack()
|
||||||
print(command)
|
|
||||||
r = requests.post(
|
r = requests.post(
|
||||||
"https://slack.com/api/views.open",
|
"https://slack.com/api/views.open",
|
||||||
headers={"Authorization": f"Bearer {os.environ['SLACK_TOKEN']}"},
|
headers={"Authorization": f"Bearer {os.environ['SLACK_TOKEN']}"},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue