Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 3 additions & 15 deletions report/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,14 @@ async def reports_logchannel(self, ctx: commands.GuildContext, channel: discord.

@_reports.command("confirmation")
@commands.guild_only()
async def reports_confirm(self, ctx: commands.GuildContext, option: str):
async def reports_confirm(self, ctx: commands.GuildContext, option: bool):
"""Whether a confirmation should be sent to reporters.

Example:
- `[p]reports confirm <True|False>`
"""
try:
confirmation = strtobool(option)
except ValueError:
await ctx.send("❌ Invalid option. Use: `[p]reports confirm <True|False>`")
return
await self.config.guild(ctx.guild).confirmations.set(confirmation)
await ctx.send(f"✅ Report confirmations {'enabled' if confirmation else 'disabled'}")
await self.config.guild(ctx.guild).confirmations.set(option)
await ctx.send(f"✅ Report confirmations {'enabled' if option else 'disabled'}")

@_reports.command("status")
@commands.guild_only()
Expand Down Expand Up @@ -247,10 +242,3 @@ def make_reporter_reply(
.add_field(name="Report Origin", value=channel.mention)
.add_field(name="Report Content", value=escape(report_body or "<no message>"))
)


def strtobool(value: str) -> bool:
value = value.lower()
if value in ("y", "yes", "on", "1", "true", "t"):
return True
return False
Loading