Completed
Push — master ( 322940...55aad5 )
by Anas
34s
created

sticker_rep()   A

Complexity

Conditions 4

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 4
c 1
b 0
f 0
dl 0
loc 7
rs 9.2
1
#!/usr/bin/python
2
# -*- coding: utf-8 -*-
3
from telegram.ext import MessageHandler, Filters
4
import datetime
5
6
def module_init(gd):
7
    global keywords, sticker_path
8
    keywords = gd.config["keywords"]
9
    sticker_path = gd.config["sticker_path"]
10
    gd.dp.add_handler(MessageHandler(Filters.text, sticker_rep))
11
12
13
def sticker_rep(bot, update):
14
    for word in keywords:
15
        if word in update.message.text:
16
            with open(sticker_path, "rb") as sticker:
17
                update.message.reply_sticker(sticker)
18
            print(datetime.datetime.now(), ">>>", "Sticker", ">>>", update.message.from_user.username)
19
            break
20