Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions pybot/endpoints/airtable/message_templates/messages.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from typing import List


def mentor_request_text(user_id, service, skillsets, affiliation, requested_mentor_message=None):
def mentor_request_text(
user_id, service, skillsets, affiliation, requested_mentor_message=None
):
if not skillsets:
skillsets = "None provided"
text = (
Expand Down Expand Up @@ -30,7 +32,7 @@ def claim_mentee_attachment(record: str) -> List[dict]:
"text": "Claim Mentee",
"type": "button",
"style": "primary",
"value": f"mentee_claimed",
"value": "mentee_claimed",
}
],
}
Expand Down
2 changes: 1 addition & 1 deletion pybot/endpoints/airtable/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def _create_messages(
slack_id,
service_translation,
request.get("skillsets", None),
request.get('affiliation', 'None Provided'),
request.get("affiliation", "None Provided"),
requested_mentor_message,
),
"attachments": claim_mentee_attachment(request["record"]),
Expand Down
2 changes: 1 addition & 1 deletion pybot/endpoints/api/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from slack.io.abc import SlackAPI
from slack.methods import Methods

from pybot.endpoints.slack.utils import PYBOT_ENV, OPS_CHANNEL
from pybot.endpoints.slack.utils import OPS_CHANNEL, PYBOT_ENV
from pybot.endpoints.slack.utils.action_messages import (
TICKET_OPTIONS,
not_claimed_attachment,
Expand Down
7 changes: 2 additions & 5 deletions pybot/endpoints/slack/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,16 @@ async def slash_mentor(command: Command, app: SirBot):

@catch_command_slack_error
async def slash_mentor_volunteer(command: Command, app: SirBot) -> None:
airtable = app.plugins["airtable"].api
skillsets = await airtable.get_all_records("Skillsets", "Name")

blocks = mentor_volunteer_blocks(skillsets)
response = {
"text": "Mentor Sign up Form",
"blocks": blocks,
"text": "Please fill up the Mentor Sign up Form here: https://op.co.de/volunteer-signup",
"channel": command["user_id"],
"as_user": True,
}

await app.plugins["slack"].api.query(methods.CHAT_POST_MESSAGE, response)


@catch_command_slack_error
async def slash_report(command: Command, app: SirBot):
"""
Expand Down
2 changes: 1 addition & 1 deletion pybot/endpoints/slack/message_templates/mentor_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def mentee_claimed_attachment(self) -> dict:
"actions": [
{
"name": f"{self.record}",
"text": f"Reset claim",
"text": "Reset claim",
"type": "button",
"style": "danger",
"value": "reset_claim_mentee",
Expand Down
4 changes: 2 additions & 2 deletions pybot/endpoints/slack/utils/action_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def greeted_attachment(user_id: str) -> List[dict]:
"actions": [
{
"name": "reset_greet",
"text": f"Reset claim",
"text": "Reset claim",
"type": "button",
"style": "danger",
"value": "reset_greet",
Expand Down Expand Up @@ -165,7 +165,7 @@ def claimed_attachment(user_id):
"actions": [
{
"name": "reset_claim",
"text": f"Reset claim",
"text": "Reset claim",
"type": "button",
"style": "danger",
"value": "reset_claim",
Expand Down
2 changes: 1 addition & 1 deletion pybot/endpoints/slack/utils/slash_lunch.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
class LunchCommand:
DEFAULT_LUNCH_DISTANCE = 20
MIN_LUNCH_RANGE = 1
AUTH_HEADER = {f"Authorization": f"Bearer {YELP_TOKEN}"}
AUTH_HEADER = {"Authorization": f"Bearer {YELP_TOKEN}"}

def __init__(self, channel: str, user: str, input_text: str, user_name: str):

Expand Down
6 changes: 3 additions & 3 deletions pybot/plugins/airtable/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ def __init__(self, session, api_key, base_key):
self.base_key = base_key

async def get(self, url, **kwargs):
auth_header = {f"Authorization": f"Bearer {self.api_key}"}
auth_header = {"Authorization": f"Bearer {self.api_key}"}

async with self.session.get(url, headers=auth_header, **kwargs) as r:
return await r.json()

async def patch(self, url, **kwargs):
auth_header = {f"authorization": f"Bearer {self.api_key}"}
auth_header = {"authorization": f"Bearer {self.api_key}"}
async with self.session.patch(url, headers=auth_header, **kwargs) as r:
r.raise_for_status()
return await r.json()

async def post(self, url, **kwargs):
auth_header = {f"authorization": f"Bearer {self.api_key}"}
auth_header = {"authorization": f"Bearer {self.api_key}"}
async with self.session.post(url, headers=auth_header, **kwargs) as r:
return await r.json()

Expand Down