[Streams] Allow for consume all on messages (#4183)

* Added consume all to streams.

* Updated help doc

* Styling checks, man...
This commit is contained in:
Kowlin 2020-08-15 15:04:05 +02:00 committed by GitHub
parent 46eb9ce7a0
commit bf581b9f97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -497,14 +497,13 @@ class Streams(commands.Cog):
@message.command(name="mention") @message.command(name="mention")
@commands.guild_only() @commands.guild_only()
async def with_mention(self, ctx: commands.Context, message: str = None): async def with_mention(self, ctx: commands.Context, *, message: str = None):
"""Set stream alert message when mentions are enabled. """Set stream alert message when mentions are enabled.
Use `{mention}` in the message to insert the selected mentions. Use `{mention}` in the message to insert the selected mentions.
Use `{stream}` in the message to insert the channel or user name.
Use `{stream.name}` in the message to insert the channel or user name. For example: `[p]streamset message mention {mention}, {stream} is live!`
For example: `[p]streamset message mention "{mention}, {stream.name} is live!"`
""" """
if message is not None: if message is not None:
guild = ctx.guild guild = ctx.guild
@ -515,12 +514,12 @@ class Streams(commands.Cog):
@message.command(name="nomention") @message.command(name="nomention")
@commands.guild_only() @commands.guild_only()
async def without_mention(self, ctx: commands.Context, message: str = None): async def without_mention(self, ctx: commands.Context, *, message: str = None):
"""Set stream alert message when mentions are disabled. """Set stream alert message when mentions are disabled.
Use `{stream.name}` in the message to insert the channel or user name. Use `{stream}` in the message to insert the channel or user name.
For example: `[p]streamset message nomention "{stream.name} is live!"` For example: `[p]streamset message nomention {stream} is live!`
""" """
if message is not None: if message is not None:
guild = ctx.guild guild = ctx.guild
@ -720,7 +719,12 @@ class Streams(commands.Cog):
channel.guild channel.guild
).live_message_mention() ).live_message_mention()
if alert_msg: if alert_msg:
content = alert_msg.format(mention=mention_str, stream=stream) content = alert_msg # Stop bad things from happening here...
content = content.replace(
"{stream.name}", str(stream.name)
) # Backwards compatability
content = content.replace("{stream}", str(stream.name))
content = content.replace("{mention}", mention_str)
else: else:
content = _("{mention}, {stream} is live!").format( content = _("{mention}, {stream} is live!").format(
mention=mention_str, mention=mention_str,
@ -733,7 +737,11 @@ class Streams(commands.Cog):
channel.guild channel.guild
).live_message_nomention() ).live_message_nomention()
if alert_msg: if alert_msg:
content = alert_msg.format(stream=stream) content = alert_msg # Stop bad things from happening here...
content = content.replace(
"{stream.name}", str(stream.name)
) # Backwards compatability
content = content.replace("{stream}", str(stream.name))
else: else:
content = _("{stream} is live!").format( content = _("{stream} is live!").format(
stream=escape( stream=escape(