Total Complexity | 6 |
Total Lines | 24 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | #!/usr/bin/python |
||
2 | # -*- coding: utf-8 -*- |
||
3 | from telegram.ext import MessageHandler, Filters |
||
4 | from datetime import datetime |
||
5 | |||
6 | |||
7 | def module_init(gd): |
||
8 | global keywords, sticker_path |
||
9 | keywords = gd.config["keywords"] |
||
10 | sticker_path = gd.config["sticker_path"] |
||
11 | gd.dp.add_handler(MessageHandler(Filters.text, sticker_rep)) |
||
12 | |||
13 | |||
14 | def sticker_rep(bot, update): |
||
15 | current_time = datetime.strftime(datetime.now(), "%d.%m.%Y %H:%M:%S") |
||
16 | if update.effective_message.chat.type == "channel": |
||
17 | return |
||
18 | for word in keywords: |
||
|
|||
19 | if word in update.message.text: |
||
20 | with open(sticker_path, "rb") as sticker: |
||
21 | update.message.reply_sticker(sticker) |
||
22 | print(current_time, ">", "sticker", ">", update.message.from_user.username) |
||
23 | break |
||
24 |