|
1 | 1 | import logging |
2 | 2 | import random |
3 | 3 | import time |
4 | | -from typing import Dict, Tuple |
| 4 | +from typing import Tuple |
5 | 5 |
|
6 | 6 | from tor.core.config import ( |
7 | 7 | SLACK_COC_ACCEPTED_CHANNEL_ID, |
|
48 | 48 | ] |
49 | 49 |
|
50 | 50 |
|
| 51 | +def modchat_blocked_user_ping(username: str, blossom_submission: dict, cfg: Config) -> None: |
| 52 | + user_url = i18n["urls"]["reddit_url"].format(f"/u/{username}") |
| 53 | + send_to_modchat( |
| 54 | + f":no_entry_sign: Blocked user <{user_url}|u/{username}> is trying to transcribe." |
| 55 | + f" <{blossom_submission['tor_url']}|Thread link>", |
| 56 | + cfg, |
| 57 | + ) |
| 58 | + |
| 59 | + |
51 | 60 | @beeline.traced(name="process_coc") |
52 | 61 | def process_coc( |
53 | | - username: str, context: str, blossom_submission: Dict, cfg: Config |
| 62 | + username: str, context: str, blossom_submission: dict, cfg: Config |
54 | 63 | ) -> Tuple: |
55 | 64 | """ |
56 | 65 | Process the acceptation of the CoC by the specified user. |
@@ -93,7 +102,7 @@ def process_coc( |
93 | 102 |
|
94 | 103 | @beeline.traced(name="process_claim") |
95 | 104 | def process_claim( |
96 | | - username: str, blossom_submission: Dict, cfg: Config, first_time=False |
| 105 | + username: str, blossom_submission: dict, cfg: Config, first_time=False |
97 | 106 | ) -> Tuple: |
98 | 107 | """ |
99 | 108 | Process a claim request. |
@@ -140,6 +149,7 @@ def process_claim( |
140 | 149 |
|
141 | 150 | elif response.status == BlossomStatus.blocked: |
142 | 151 | message = i18n["responses"]["general"]["blocked"] |
| 152 | + modchat_blocked_user_ping(username, blossom_submission, cfg) |
143 | 153 |
|
144 | 154 | elif response.status == BlossomStatus.already_claimed: |
145 | 155 | claimed_by = response.data["username"] |
@@ -167,7 +177,7 @@ def process_claim( |
167 | 177 | @beeline.traced(name="process_done") |
168 | 178 | def process_done( |
169 | 179 | user: Redditor, |
170 | | - blossom_submission: Dict, |
| 180 | + blossom_submission: dict, |
171 | 181 | comment: Comment, |
172 | 182 | cfg: Config, |
173 | 183 | override=False, |
@@ -291,13 +301,14 @@ def process_done( |
291 | 301 |
|
292 | 302 | elif done_response.status == BlossomStatus.blocked: |
293 | 303 | message = i18n["responses"]["general"]["blocked"] |
| 304 | + modchat_blocked_user_ping(user.name, blossom_submission, cfg) |
294 | 305 |
|
295 | 306 | return message, return_flair |
296 | 307 |
|
297 | 308 |
|
298 | 309 | @beeline.traced(name="process_unclaim") |
299 | 310 | def process_unclaim( |
300 | | - username: str, blossom_submission: Dict, submission: Submission, cfg: Config |
| 311 | + username: str, blossom_submission: dict, submission: Submission, cfg: Config |
301 | 312 | ) -> Tuple: |
302 | 313 | """ |
303 | 314 | Process an unclaim request. |
@@ -333,6 +344,7 @@ def process_unclaim( |
333 | 344 | message = unclaim_messages["post_already_completed"] |
334 | 345 | elif response.status == BlossomStatus.blocked: |
335 | 346 | message = i18n["responses"]["general"]["blocked"] |
| 347 | + modchat_blocked_user_ping(username, blossom_submission, cfg) |
336 | 348 | else: |
337 | 349 | message = unclaim_messages["still_unclaimed"] |
338 | 350 | return message, return_flair |
|
0 commit comments