[Trivia] Commands for managing custom trivia lists #3420
No reviewers
Labels
No labels
Automated PR
Blocked
Blocked By: Damage Control
Blocked By: Dependency
Blocked By: Other PR
Breaking Change
Category: CI
Category: Cogs - Admin
Category: Cogs - Alias
Category: Cogs - Audio
Category: Cogs - Bank
Category: Cogs - Cleanup
Category: Cogs - CustomCommands
Category: Cogs - Dev
Category: Cogs - Downloader
Category: Cogs - Economy
Category: Cogs - Filter
Category: Cogs - General
Category: Cogs - Image
Category: Cogs - Mod
Category: Cogs - Modlog
Category: Cogs - Mutes
Category: Cogs - Permissions
Category: Cogs - Reports
Category: Cogs - Streams
Category: Cogs - Trivia
Category: Cogs - Trivia - Lists
Category: Cogs - Warnings
Category: Core - API - App Commands Package
Category: Core - API - Audio
Category: Core - API - Bank
Category: Core - API - Commands Package
Category: Core - API - Config
Category: Core - API - Other
Category: Core - API - Utils Package
Category: Core - Bot Class
Category: Core - Bot Commands
Category: Core - Command-line Interfaces
Category: Core - Downloader
Category: Core - Help
Category: Core - i18n
Category: Core - Modlog
Category: Core - Other Internals
Category: Core - RPC/ZMQ
Category: Docker
Category: Docs - Changelogs
Category: Docs - For Developers
Category: Docs - Install Guides
Category: Docs - Other
Category: Docs - User Guides
Category: Meta
Category: RPC/ZMQ methods
Category: Vendored Packages
Changelog Entry: Added
Changelog Entry: Pending
Changelog Entry: Skipped
Closed: Duplicate
Closed: External
Closed: Invalid
Closed: User Error
Closed: Won't Fix
Complex Issue
Docs-only
Feature Branch
Good First Issue
Help Wanted
High Priority
Needs Backport To stable-docs
No Activity
No Repro
QA: Bypassed
QA: Changes Requested
QA: Passed
Release Blocker
Status: Accepted
Status: Frozen
Status: In Progress
Status: Needs Discussion
Status: Needs Info
Status: Needs Triage
Status: PRs Welcome
Type: Bug
Type: Dependency Update
Type: Deprecation
Type: Enhancement
Type: Feature
Type: Informational
Type: Merge
Type: Optimisation
Type: Question
Type: Removal
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Mrcoolgamer11/Red-DiscordBot!3420
Loading…
Reference in a new issue
No description provided.
Delete branch "trivia-upload"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Type
Description of the changes
Trivia upload command.
This is a draft PR so I can take ideas or if I am going in the wrong direction.
Resolves #3307.
How do we want to support duplicate lists?
I am thinking if a duplicate list is uploaded to either ask to overwrite or skip?
And also if a list has the same name as a baselist warn user and gracefully error?
Does these two ideas sond good.
I would personally say if a playlist with the same name we prompt the user to override or skip. or simply silently fail and at the end of the command give a report to the user with failed list and reason it failed.
Do we need a delete command?
Part 2 will include deletion and also a way to see what is a custom list.
Part 3 which is later will include interactive generator. #3422
This is WIP.
just something I noticed, don't know if the PR is intended to be ready yet. You've already saved this to a BytesIO object, just write the object, dont download from discord again
Thank you, changed it.
This is pretty much done and ready to go for review.
Overall, a good PR, there are few things that need changing but nothing major.
@ -186,0 +251,4 @@except yaml.error.YAMLError:await ctx.send(_("There was an error parsing the trivia list. See logs for more info."))While I get why it's useful for bot owner to know which lists are custom (since these are the only ones owner can remove), I don't think it really should be shown to users like this. Maybe there should be a separate command for listing uploaded (custom) lists?
I think it might be worth sending the syntax error that happened during parsing of the YAML file (based on how permissions cog does it):
And logging here is not gonna really be needed then as all the needed info is gonna already be in the sent message.
I propose using a timeout here, maybe 30 seconds?
It would be better to check against list of subcommands programatically than hardcoding those names:
This check should probably happen before we try to download the attachment.
String has to be formatted after translation.
String has to be formatted after translation.
This string has to be wrapped in
_()for translations.I think it might be friendlier to use reactions here, but it's up to you. Whatever you choose, use a timeout here as well.
I don't think logging is really needed here.
Nitpick, I think using only bool type for this variable makes more sense here
@ -186,0 +251,4 @@except yaml.error.YAMLError:await ctx.send(_("There was an error parsing the trivia list. See logs for more info."))Adding custom command trivialist while list shows all of it.
@ -186,0 +214,4 @@title=_("Uploaded trivia lists"),colour=await ctx.embed_colour(),description=", ".join(sorted(personal_lists)),)0 lists should be special-cased:

@ -186,0 +219,4 @@else:msg = box(bold(_("Uploaded trivia lists")) + "\n\n" + ", ".join(sorted(personal_lists)))You have to return at the end of this
ifLGTM, thanks for the PR!