diff options
| author | 2019-09-14 22:09:35 +0800 | |
|---|---|---|
| committer | 2019-09-14 22:09:35 +0800 | |
| commit | 4bc4dc797258abe9f1b432260b47a9abf7e999c8 (patch) | |
| tree | f89b6af40a8381d3e413997fedf3d6cc786ca5d5 | |
| parent | Add more_itertools as a dependency (diff) | |
Allow multiple words for !otn a
| -rw-r--r-- | bot/cogs/off_topic_names.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/bot/cogs/off_topic_names.py b/bot/cogs/off_topic_names.py index c0d2e5dc5..5a61425be 100644 --- a/bot/cogs/off_topic_names.py +++ b/bot/cogs/off_topic_names.py @@ -95,27 +95,31 @@ class OffTopicNames: @otname_group.command(name='add', aliases=('a',)) @with_role(*MODERATION_ROLES) - async def add_command(self, ctx, name: OffTopicName): + async def add_command(self, ctx, *names: OffTopicName): """Adds a new off-topic name to the rotation.""" + # Chain multiple words to a single one + name = "-".join(names) await self.bot.api_client.post(f'bot/off-topic-channel-names', params={'name': name}) log.info( f"{ctx.author.name}#{ctx.author.discriminator}" f" added the off-topic channel name '{name}" ) - await ctx.send(":ok_hand:") + await ctx.send(f":ok_hand: Added `{name}` to the names list.") @otname_group.command(name='delete', aliases=('remove', 'rm', 'del', 'd')) @with_role(*MODERATION_ROLES) - async def delete_command(self, ctx, name: OffTopicName): + async def delete_command(self, ctx, *names: OffTopicName): """Removes a off-topic name from the rotation.""" + # Chain multiple words to a single one + name = "-".join(names) await self.bot.api_client.delete(f'bot/off-topic-channel-names/{name}') log.info( f"{ctx.author.name}#{ctx.author.discriminator}" f" deleted the off-topic channel name '{name}" ) - await ctx.send(":ok_hand:") + await ctx.send(f":ok_hand: Removed `{name}` from the names list.") @otname_group.command(name='list', aliases=('l',)) @with_role(*MODERATION_ROLES) |