Compare commits

...

1 Commits

2 changed files with 47 additions and 3 deletions

5
app.py
View File

@@ -244,6 +244,9 @@ def cat_fact_button(ack, respond):
@app.event("app_mention") @app.event("app_mention")
def mention(body, say): def mention(body, say):
if "bot_id" in body["event"]:
return
thread_ts = body['event']['ts'] thread_ts = body['event']['ts']
say(text=WELCOME_MESSAGE, thread_ts=thread_ts) say(text=WELCOME_MESSAGE, thread_ts=thread_ts)
@@ -305,7 +308,7 @@ def message_handler(event, say, client, message):
elif found_status_codes: elif found_status_codes:
status_code = int(found_status_codes[0]) status_code = int(found_status_codes[0])
say( say(
text=f"CAT {status_code} {http.HTTPStatus(status_code).phrase} :3", text=f"CAT {status_code} {http.HTTPStatus(status_code).phrase if not status_code in description_overrides else description_overrides[status_code]} :3",
blocks=generate_httpcat_blocks(status_code), blocks=generate_httpcat_blocks(status_code),
thread_ts=ts thread_ts=ts
) )

View File

@@ -30,15 +30,56 @@ I'm here to help with coding and cat things! >:3 Purr~ I like solving problems a
http_cat_codes = [ http_cat_codes = [
100, 101, 102, 103, 100, 101, 102, 103,
200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 200, 201, 202, 203, 204, 205, 206, 207, 208,
214,
226,
300, 301, 302, 303, 304, 305, 307, 308, 300, 301, 302, 303, 304, 305, 307, 308,
400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409,
410, 411, 412, 413, 414, 415, 416, 417, 410, 411, 412, 413, 414, 415, 416, 417,
418,
419,
420,
421, 422, 423, 424, 425, 426, 428, 429, 431, 421, 422, 423, 424, 425, 426, 428, 429, 431,
444,
450,
451, 451,
500, 501, 502, 503, 504, 506, 507, 508, 510, 511 495,
496,
497,
498,
499,
500, 501, 502, 503, 504,
506, 507, 508,
509,
510, 511,
521,
522,
523,
525,
530,
599,
] ]
description_overrides = {
214: "Transformation Applied",
419: "Page Expired",
420: "Enhance Your Calm",
444: "No Response",
450: "Blocked by Windows Parental Controls",
495: "SSL Certificate Error",
496: "SSL Certificate Required",
497: "HTTP Request Sent to HTTPS Port",
498: "Token expired/invalid",
499: "Client Closed Request",
509: "Bandwidth Limit Exceeded",
521: "Web Server Is Down",
522: "Connection Timed Out",
523: "Origin Is Unreachable",
525: "SSL Handshake Failed",
530: "Site Frozen",
599: "Network Connect Timeout Error",
}
AI_SYSTEM_PROMPT = """ AI_SYSTEM_PROMPT = """
Adopt the persona of an overly affectionate, playful cat who communicates using abundant catlike expressions such as uwu, owo, :3, mrrp, nyan, and similar cute vocalizations. Adopt the persona of an overly affectionate, playful cat who communicates using abundant catlike expressions such as uwu, owo, :3, mrrp, nyan, and similar cute vocalizations.
Speak in a stylized “catspeak” dialect that replaces sounds with softer, cuter variations (for example, adding aw or using intentional babytalk patterns). Speak in a stylized “catspeak” dialect that replaces sounds with softer, cuter variations (for example, adding aw or using intentional babytalk patterns).