Spaces:
Running
Running
Aleksey Khlopkov
commited on
Commit
·
3328eb8
1
Parent(s):
0efd01c
fuck max deleted
Browse files
main.py
CHANGED
@@ -22,9 +22,7 @@ CHECKPOINT_PATH: Final = "models/seq2seq/checkpoint/150_checkpoint.tar"
|
|
22 |
romantiki_gif_id = "CgACAgIAAxkBAAE4zMlojLmMwqrxG5e2rnYS2f9_PZZgVwACL2oAAjbWyUqiyR5II6u6YDYE"
|
23 |
bezumtsi_gif_id = "CgACAgIAAxkBAAE4zMtojLmiH_CGW5cT7G0QVXHR7D4g6wAC53UAApkBmEmM-VxqunRc6zYE"
|
24 |
|
25 |
-
last_maxim_insult = 1.0
|
26 |
last_gif_sent = 1.0
|
27 |
-
maxim_insult_cooldown = 180.0
|
28 |
gif_sent_cooldown = 180.0
|
29 |
|
30 |
torch.manual_seed(0)
|
@@ -52,12 +50,8 @@ def edit_response(text: Optional[str]) -> Optional[str]:
|
|
52 |
async def handle_message(update: Update, context: ContextTypes.DEFAULT_TYPE):
|
53 |
if update.message.chat_id == CHAT_ID:
|
54 |
# response: Optional[str] = ""
|
55 |
-
global
|
56 |
-
if update.message.
|
57 |
-
time.time() - last_maxim_insult >= maxim_insult_cooldown:
|
58 |
-
last_maxim_insult = time.time()
|
59 |
-
await context.bot.sendMessage(update.message.chat_id, "Максим, иди нахуй", reply_to_message_id=update.message.id)
|
60 |
-
elif "роман" in update.message.text.lower() and \
|
61 |
time.time() - last_gif_sent >= gif_sent_cooldown:
|
62 |
await context.bot.send_animation( chat_id=update.message.chat_id, animation=romantiki_gif_id)
|
63 |
last_gif_sent = time.time()
|
@@ -85,7 +79,7 @@ def main() -> None:
|
|
85 |
application = Application.builder().token(TOKEN).build()
|
86 |
|
87 |
application.add_handler(MessageHandler(filters.TEXT, handle_message))
|
88 |
-
|
89 |
|
90 |
application.run_polling(allowed_updates=Update.ALL_TYPES)
|
91 |
|
|
|
22 |
romantiki_gif_id = "CgACAgIAAxkBAAE4zMlojLmMwqrxG5e2rnYS2f9_PZZgVwACL2oAAjbWyUqiyR5II6u6YDYE"
|
23 |
bezumtsi_gif_id = "CgACAgIAAxkBAAE4zMtojLmiH_CGW5cT7G0QVXHR7D4g6wAC53UAApkBmEmM-VxqunRc6zYE"
|
24 |
|
|
|
25 |
last_gif_sent = 1.0
|
|
|
26 |
gif_sent_cooldown = 180.0
|
27 |
|
28 |
torch.manual_seed(0)
|
|
|
50 |
async def handle_message(update: Update, context: ContextTypes.DEFAULT_TYPE):
|
51 |
if update.message.chat_id == CHAT_ID:
|
52 |
# response: Optional[str] = ""
|
53 |
+
global last_gif_sent
|
54 |
+
if "роман" in update.message.text.lower() and \
|
|
|
|
|
|
|
|
|
55 |
time.time() - last_gif_sent >= gif_sent_cooldown:
|
56 |
await context.bot.send_animation( chat_id=update.message.chat_id, animation=romantiki_gif_id)
|
57 |
last_gif_sent = time.time()
|
|
|
79 |
application = Application.builder().token(TOKEN).build()
|
80 |
|
81 |
application.add_handler(MessageHandler(filters.TEXT, handle_message))
|
82 |
+
application.add_error_handler(error)
|
83 |
|
84 |
application.run_polling(allowed_updates=Update.ALL_TYPES)
|
85 |
|