2
0
mirror of https://github.com/Nick80835/microbot synced 2025-08-31 06:26:04 +00:00

add support for multiple command prefixes

This commit is contained in:
Nick80835
2020-06-22 09:38:31 -04:00
parent eaa3c06a1d
commit b28abaec50

View File

@@ -24,10 +24,10 @@ class CommandHandler():
client.add_event_handler(self.handle_callback_query, events.CallbackQuery())
async def handle_incoming(self, event):
prefix = escape(self.settings.get_config("cmd_prefix") or '.')
prefix = "|".join([escape(i) for i in (self.settings.get_list("cmd_prefix") or ['.'])])
for value in self.incoming_commands:
pattern_match = search(self.pattern_template.format("" if value["noprefix"] else prefix, value["pattern"], self.username), event.text)
pattern_match = search(self.pattern_template.format("" if value["noprefix"] else f"({prefix})", value["pattern"], self.username), event.text)
if pattern_match:
if self.is_blacklisted(event):