Skip to content

Commit fe0a5c3

Browse files
committed
update with ping for modchat
1 parent 938fb67 commit fe0a5c3

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

tor/core/user_interaction.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import logging
22
import random
33
import time
4-
from typing import Dict, Tuple
4+
from typing import Tuple
55

66
from tor.core.config import (
77
SLACK_COC_ACCEPTED_CHANNEL_ID,
@@ -48,9 +48,18 @@
4848
]
4949

5050

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+
5160
@beeline.traced(name="process_coc")
5261
def process_coc(
53-
username: str, context: str, blossom_submission: Dict, cfg: Config
62+
username: str, context: str, blossom_submission: dict, cfg: Config
5463
) -> Tuple:
5564
"""
5665
Process the acceptation of the CoC by the specified user.
@@ -93,7 +102,7 @@ def process_coc(
93102

94103
@beeline.traced(name="process_claim")
95104
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
97106
) -> Tuple:
98107
"""
99108
Process a claim request.
@@ -140,6 +149,7 @@ def process_claim(
140149

141150
elif response.status == BlossomStatus.blocked:
142151
message = i18n["responses"]["general"]["blocked"]
152+
modchat_blocked_user_ping(username, blossom_submission, cfg)
143153

144154
elif response.status == BlossomStatus.already_claimed:
145155
claimed_by = response.data["username"]
@@ -167,7 +177,7 @@ def process_claim(
167177
@beeline.traced(name="process_done")
168178
def process_done(
169179
user: Redditor,
170-
blossom_submission: Dict,
180+
blossom_submission: dict,
171181
comment: Comment,
172182
cfg: Config,
173183
override=False,
@@ -291,13 +301,14 @@ def process_done(
291301

292302
elif done_response.status == BlossomStatus.blocked:
293303
message = i18n["responses"]["general"]["blocked"]
304+
modchat_blocked_user_ping(user.name, blossom_submission, cfg)
294305

295306
return message, return_flair
296307

297308

298309
@beeline.traced(name="process_unclaim")
299310
def process_unclaim(
300-
username: str, blossom_submission: Dict, submission: Submission, cfg: Config
311+
username: str, blossom_submission: dict, submission: Submission, cfg: Config
301312
) -> Tuple:
302313
"""
303314
Process an unclaim request.
@@ -333,6 +344,7 @@ def process_unclaim(
333344
message = unclaim_messages["post_already_completed"]
334345
elif response.status == BlossomStatus.blocked:
335346
message = i18n["responses"]["general"]["blocked"]
347+
modchat_blocked_user_ping(username, blossom_submission, cfg)
336348
else:
337349
message = unclaim_messages["still_unclaimed"]
338350
return message, return_flair

tor/strings/en_US.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ responses:
167167
getting_help: |
168168
✅ Help is on the way! I have notified the mods and someone should be here to assist you soon.
169169
blocked: |
170-
⛔ Sorry you can't transcribe at this time. Please message the mods through modmail.
170+
⛔ Sorry, you can't transcribe at this time. Please [message the mods](https://www.reddit.com/message/compose?to=%2Fr%2FTranscribersOfReddit&subject=Blocked%20from%20Transcribing&message=) through modmail.
171171
oops: |
172172
⛔ Something appears to have gone wrong. Please message the moderators of r/TranscribersOfReddit to have them look at this. Thanks!
173173
coc_not_accepted: |

0 commit comments

Comments
 (0)