|
1 | 1 | #!/usr/bin/enb python3 |
2 | 2 |
|
3 | 3 | from datetime import datetime as DateTime |
| 4 | +import itertools |
4 | 5 | import argparse |
5 | 6 | import logging |
6 | 7 | import sys |
@@ -102,6 +103,22 @@ async def command_zen(self, update: Update, context: ContextTypes.DEFAULT_TYPE): |
102 | 103 | parse_mode=ParseMode.HTML, |
103 | 104 | ) |
104 | 105 |
|
| 106 | + async def command_config(self, update: Update, context: ContextTypes.DEFAULT_TYPE): |
| 107 | + self.trace('Received command: /config') |
| 108 | + buff = [ |
| 109 | + 'Probabilidad de responder: {config.VERBOSITY:.2f}', |
| 110 | + 'Disparadores:', |
| 111 | + ] |
| 112 | + trigger_words = sorted(list(itertools.chain(*config.REPLIES.keys()))) |
| 113 | + for word in trigger_words: |
| 114 | + buff.append(f' - {word}') |
| 115 | + text = '\n'.join(buff) |
| 116 | + await context.bot.send_message( |
| 117 | + chat_id=update.effective_chat.id, |
| 118 | + text=text, |
| 119 | + parse_mode=ParseMode.HTML, |
| 120 | + ) |
| 121 | + |
105 | 122 | async def welcome(self, update: Update, context): |
106 | 123 | self.trace('Received new user event') |
107 | 124 | new_member = update.message.new_chat_members[0] |
@@ -153,6 +170,9 @@ def run(self): |
153 | 170 | # Zen Command |
154 | 171 | application.add_handler(CommandHandler('zen', self.command_zen)) |
155 | 172 |
|
| 173 | + # Config Command |
| 174 | + application.add_handler(CommandHandler('config', self.command_config)) |
| 175 | + |
156 | 176 | welcome_handler = MessageHandler( |
157 | 177 | filters.StatusUpdate.NEW_CHAT_MEMBERS, |
158 | 178 | self.welcome, |
|
0 commit comments