* [PATCH v1] atom/utils: Add Telegram CC list to get us mentioned
@ 2022-12-24 22:17 Ammar Faizi
0 siblings, 0 replies; only message in thread
From: Ammar Faizi @ 2022-12-24 22:17 UTC (permalink / raw)
To: GNU/Weeb Mailing List
Cc: Ammar Faizi, Muhammad Rizki, Alviro Iskandar Setiawan
From: Ammar Faizi <[email protected]>
It's safe to put them here temporarily because it's only us who use
this daemon. Plus, there is no secret information.
TODO(ammarfaizi2): Move this somewhere else.
Signed-off-by: Ammar Faizi <[email protected]>
---
daemon/atom/utils.py | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/daemon/atom/utils.py b/daemon/atom/utils.py
index 80c74b0..96a10a0 100644
--- a/daemon/atom/utils.py
+++ b/daemon/atom/utils.py
@@ -94,13 +94,36 @@ def extract_list(key: str, thread: Message):
return []
return __extract_list(people)
+#
+# TODO(ammarfaizi2): Move this somewhere else.
+#
+# It's safe to put them here temporarily because it's only us
+# who use this daemon. Plus, there is no secret information
+# here.
+#
+def __construct_tg_cc(ls, tg_cc_arr):
+ lcc = [
+ [r"[email protected]", "@fernandafmr2"],
+ [r"[email protected]", "@ammarfaizi2"],
+ [r"[email protected]", "@nekoha"],
+ [r"[email protected]", "@Viro_SSFS"],
+ [r"[email protected]", "@KnScarlet"],
+ [r"[email protected]", "@rlapz"],
+ ]
+ for i in lcc:
+ if re.search(i[0], ls) and i[1] not in tg_cc_arr:
+ tg_cc_arr.append(i[1])
+ return
def consruct_to_n_cc(to: list, cc: list):
NR_MAX_LIST = 20
+ tg_cc_arr = []
+ tg_cc = ""
n = 0
ret = ""
for i in to:
+ __construct_tg_cc(i, tg_cc_arr)
if n >= NR_MAX_LIST:
ret += "To: ...\n"
break
@@ -109,6 +132,7 @@ def consruct_to_n_cc(to: list, cc: list):
ret += f"To: {i}\n"
for i in cc:
+ __construct_tg_cc(i, tg_cc_arr)
if n >= NR_MAX_LIST:
ret += "Cc: ...\n"
break
@@ -116,6 +140,13 @@ def consruct_to_n_cc(to: list, cc: list):
n += 1
ret += f"Cc: {i}\n"
+ if len(tg_cc_arr):
+ tg_cc = "Telegram-Cc:"
+ for i in tg_cc_arr:
+ tg_cc += " "+i
+ tg_cc += "\n"
+
+ ret += tg_cc
return ret
base-commit: 69eaa512d015a30b2cfbc7b230771372283b4b57
--
Ammar Faizi
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2022-12-24 22:17 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-24 22:17 [PATCH v1] atom/utils: Add Telegram CC list to get us mentioned Ammar Faizi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox