[Streams] [p]streamalert twitch channel is not for Discord channels (#2048)

Resolves #2003.

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
This commit is contained in:
Toby Harradine 2018-08-26 23:18:22 +10:00 committed by GitHub
parent 0aca00b245
commit f595afab18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -141,14 +141,20 @@ class Streams:
async def streamalert(self, ctx: commands.Context): async def streamalert(self, ctx: commands.Context):
pass pass
@streamalert.group(name="twitch") @streamalert.group(name="twitch", invoke_without_command=True)
async def _twitch(self, ctx: commands.Context): async def _twitch(self, ctx: commands.Context, channel_name: str = None):
"""Twitch stream alerts""" """Twitch stream alerts"""
pass if channel_name is not None:
await ctx.invoke(self.twitch_alert_channel, channel_name)
else:
await ctx.send_help()
@_twitch.command(name="channel") @_twitch.command(name="channel")
async def twitch_alert_channel(self, ctx: commands.Context, channel_name: str): async def twitch_alert_channel(self, ctx: commands.Context, channel_name: str):
"""Sets a Twitch alert notification in the channel""" """Sets a Twitch alert notification in the channel"""
if re.fullmatch(r"<#\d+>", channel_name):
await ctx.send("Please supply the name of a *Twitch* channel, not a Discord channel.")
return
await self.stream_alert(ctx, TwitchStream, channel_name.lower()) await self.stream_alert(ctx, TwitchStream, channel_name.lower())
@_twitch.command(name="community") @_twitch.command(name="community")