Merge pull request #12 from kitlith/rules

Add functionality for printing rules to a rules channel.
This commit is contained in:
Ave 2019-02-08 12:17:17 +00:00 committed by GitHub
commit ec14b4ed6e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -112,9 +112,10 @@ class Verification:
@commands.command()
async def reset(self, ctx, limit: int = 100, force: bool = False):
"""Wipes messages and pastes the welcome message again. Staff only."""
if ctx.message.channel.id != config.welcome_channel and not force:
if ctx.message.channel.id not in [config.welcome_channel, config.rules_channel] and not force:
await ctx.send(f"This command is limited to"
f" <#{config.welcome_channel}>, unless forced.")
f" <#{config.welcome_channel}> or "
f" <#{config.rules_channel}>, unless forced.")
return
await ctx.channel.purge(limit=limit)
@ -122,6 +123,7 @@ class Verification:
await ctx.send(welcome_header)
rules = ['**{}**. {}'.format(i, cleandoc(r)) for i, r in
enumerate(welcome_rules, 1)]
if (ctx.message.channel.id is config.welcome_channel):
rule_choice = random.randint(2, len(rules))
rules[rule_choice - 1] += '\n' + hidden_term_line
msg = f"🗑 **Reset**: {ctx.author.mention} cleared {limit} messages "\