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

module_init()   A

Complexity

Conditions 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
c 2
b 0
f 0
dl 0
loc 5
rs 9.4285
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