Completed
Push — master ( bd88c3...a4cb31 )
by Anas
01:42 queued 20s
created

leet()   A

Complexity

Conditions 3

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 5
Bugs 0 Features 0
Metric Value
cc 3
c 5
b 0
f 0
dl 0
loc 14
rs 9.4285
1
#!/usr/bin/python
2
# -*- coding: utf-8 -*-
3
from modules.logging import log_command
4
from telegram.ext import CommandHandler
5
from datetime import datetime
6
from zalgo_text import zalgo    
7
8
9
def module_init(gd):
10
    commands = gd.config["commands"]
11
    for command in commands:
12
        gd.dp.add_handler(CommandHandler(command, leet, pass_args=True))
13
14
15
def leet(bot, update, args):
16
    current_time = datetime.strftime(datetime.now(), "%d.%m.%Y %H:%M:%S")
17
    if update.message.reply_to_message is not None:
18
        print(update.message.reply_to_message.text)
19
        args = update.message.reply_to_message.text
20
        args = args.split(" ")
21
    input_text = " ".join(args).lower()
22
    if input_text == "":
23
        update.message.reply_text("Type in some text!")
24
        return
25
    zalgofied_text = zalgo.zalgo().zalgofy(input_text)
26
    update.message.reply_text(zalgofied_text)
27
    print(current_time, ">", "/zalgo", ">", update.message.from_user.username)
28
    log_command(bot, update, current_time, "zalgo")
29