Total Complexity | 5 |
Total Lines | 28 |
Duplicated Lines | 0 % |
Changes | 0 |
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, zalgo_txt, pass_args=True)) |
||
13 | |||
14 | |||
15 | def zalgo_txt(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 | args = update.message.reply_to_message.text |
||
19 | args = args.split(" ") |
||
20 | input_text = " ".join(args).lower() |
||
21 | if input_text == "": |
||
22 | update.message.reply_text("Type in some text!") |
||
23 | return |
||
24 | zalgofied_text = zalgo.zalgo().zalgofy(input_text) |
||
25 | update.message.reply_text(zalgofied_text) |
||
26 | print(current_time, ">", "/zalgo", ">", update.message.from_user.username) |
||
27 | log_command(bot, update, current_time, "zalgo") |
||
28 |