diff --git a/clients/discord.py b/clients/discord.py index cc74970..4649ea1 100644 --- a/clients/discord.py +++ b/clients/discord.py @@ -50,11 +50,14 @@ class DiscordClient(discord.Client): self.logger.info('Logged in as {0}'.format(self.user.name)) async def on_message(self, message): + server = message.server.id if message.server else None for pattern, action in self.supported_commands: m = pattern.match(message.content) if m: - server = message.server.id if message.server else None await action(server, message.author.id, message, **m.groupdict()) + for cmd, resp in self.config['Extra Commands'].items(): + if cmd == message.content: + await self.send_message(message.channel, resp) async def _cooldown_failure(self, server, user, message, **kwargs): await self.send_message(message.channel, diff --git a/clients/twitch.py b/clients/twitch.py index 6ee1ca1..e5ec914 100644 --- a/clients/twitch.py +++ b/clients/twitch.py @@ -96,6 +96,9 @@ class TwitchClient(irc.bot.SingleServerIRCBot): m = pattern.match(message) if m: action(tags, send_response, **m.groupdict()) + for cmd, resp in self.config['Extra Commands'].items(): + if cmd == message: + send_response(resp) def _add_quote(self, tags, send_response, user, id, text, game, date, **kwargs): if text[0] == text[-1] == '"': diff --git a/settings.cfg.example b/settings.cfg.example index 5f811a9..25073b8 100644 --- a/settings.cfg.example +++ b/settings.cfg.example @@ -25,3 +25,6 @@ channel_ids = UC5970RJMoEcRNZl0MNp8tlQ,UCHNjavmkFUf2n0uzWSgj16w [Quotes] api_url = https://ladylilia.com/quotes/api api_key = __QUOTES_API_KEY__ + +[Extra Commands] +;!command = Response Text