From beb8daa4da1547b70efda66613f2a1e4161e104e Mon Sep 17 00:00:00 2001 From: kev Date: Sat, 2 Dec 2023 19:33:53 +0800 Subject: [PATCH] feat: add self-repeat condition --- src/component/repeat.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/component/repeat.py b/src/component/repeat.py index 08b4959..1eb6b84 100644 --- a/src/component/repeat.py +++ b/src/component/repeat.py @@ -99,8 +99,15 @@ def repeat(update: Update, context: CallbackContext): if len([True for char in char_lib if char in t]) > 0: repeated[chat_id] = True context.bot.send_message(chat_id=chat_id, text=t) + # repeat with self + if "复读" in update.message.text: + repeated[chat_id] = True + t = t.replace("你", "我") + t = t.replace("机", "鹅") + t = t.replace("鸡", "鹅") + context.bot.send_message(chat_id=chat_id, text=t * 3) # repeat 3 times with "!" - if 1 <= len(update.message.text) <= 30 and ( + elif 1 <= len(update.message.text) <= 30 and ( update.message.text.endswith("!") or update.message.text.endswith("!") ): repeated[chat_id] = True