Fix the bool fiasco with dry_run

bools can't be None, so we can't inverse this
This commit is contained in:
Marc Di Luzio 2024-08-09 00:28:06 +01:00
parent 02a9d94002
commit cd18e44032

View file

@ -24,7 +24,7 @@ guilds = []
def cache_guilds(): def cache_guilds():
"""Sync current bot guilds to a list to use""" """Sync current bot guilds to a list to use"""
guilds = list(g for g in bot.guilds if g.id in config.SERVERS) guilds = list(g for g in bot.guilds if g.id in config.SERVERS)
logger.info(f"Synced {len(guilds)} guild(s)") logger.info(f"Cached {len(guilds)} guild(s)")
@bot.event @bot.event
async def on_ready(): async def on_ready():
@ -45,8 +45,8 @@ async def sync(ctx: discord.ext.commands.context.Context):
@bot.tree.command(description = "Match matchees into groups", guilds = list(g for g in guilds if g.id in config.SERVERS)) @bot.tree.command(description = "Match matchees into groups", guilds = list(g for g in guilds if g.id in config.SERVERS))
@app_commands.describe(per_group = "Matchees per group (default 3+)", dry_run = "Run but do not post") @app_commands.describe(per_group = "Matchees per group (default 3+)", post = "Post to channel")
async def match(interaction: discord.Interaction, per_group: int = None, dry_run: bool = None): async def match(interaction: discord.Interaction, per_group: int = None, post: bool = None):
"""Match groups of channel members""" """Match groups of channel members"""
if not per_group: if not per_group:
per_group = 3 per_group = 3
@ -66,7 +66,7 @@ async def match(interaction: discord.Interaction, per_group: int = None, dry_run
return return
# Let the channel know the matching is starting # Let the channel know the matching is starting
if not dry_run: if post:
await interaction.channel.send(f"{interaction.user.display_name} asked me to match groups of {per_group}! :partying_face:") await interaction.channel.send(f"{interaction.user.display_name} asked me to match groups of {per_group}! :partying_face:")
# Find all the members in the role # Find all the members in the role
@ -91,7 +91,7 @@ async def match(interaction: discord.Interaction, per_group: int = None, dry_run
group_msgs.append(f"{util.get_ordinal(idx+1)} group: " + ", ".join(mentions)) group_msgs.append(f"{util.get_ordinal(idx+1)} group: " + ", ".join(mentions))
# Send the messages # Send the messages
if not dry_run: if post:
for msg in group_msgs: for msg in group_msgs:
await interaction.channel.send(msg) await interaction.channel.send(msg)
else: else: