[V3 config] Create voice_channels etc for config #2248
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 milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Mrcoolgamer11/Red-DiscordBot#2248
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Feature request
Select the type of feature you are requesting:
Describe your requested feature
I'm suggesting renaming the current
Config.channelstoConfig.text_channelsbecause it is more clear. Also changing the name allows for clear use of other defaults such as Voice channels and categories.By allowing the existence of
Config.voice_channelsandConfig.category_channelswould allow cog creators to have a different way of using config.An example of where this would be incredibly useful would be in my Tempvoice cog, pswd cog or any other cog that stores data about voice/category channels.
Just an FYI,
Config.channeldoes already support anything which has an id attribute castable to both a str and int (I might even be abusing this behavior of it in some places...)While I do support this improvement as you may want different registered defaults for different channel types, you can use a sentinel value in your defaults to signify this until this is handled.
I don't see any information about this in the docs... just the one line which says >
Config.channel() which takes discord.TextChannelI'm aware the docs don't elaborate on this fully, which is why for now I'm informing you the actual behavior used. There's no checking for type done there, it just grabs the id, and makes it a str as a key in a config identifier sequence. I've also edited it should be castable to an int as well.
If you'd like to PR that it accepts any
discord.abc.GuildChannelinstead, this could easily be accepted, otherwise, someone else will get to it when they can. (While the type could be wider, it would be better not to promote this usage, and add new methods for custom objects later)I agree with your sentiment, and there are quite a few things we've been thinking about changing in config. For now these will be on hold until we have a final release for 3.0 and have made some more progress on 3.1. Thanks :)
I think rather than implement this as breaking, we should retain the old behavior as there may be settings which are not channel type specific and have no need of the specificity as a result, while adding a group for each channel type.
sigh after getting around to looking into this a bit more, I noticed a "fun" detail in config.
This can still be non breaking by changing it to say...
But it's a little ugly. Still worth supporting IMO, and possibly create a cleanup for this at the next version we push with actual breakage.
Actually, because of how global scopes work (curses at getattr), this isn't non-breaking no matter what. Slate this for 3.2
I think the minimum breakage (what @mikeshardmind is saying) is that new scopes mean more functions on the Config objects, which would cause problems for cog creators who use a Global key which has the same name as the new function.
If we did it like this:
Config.channelwhich uses theConfigCategory.CHANNEL = "TEXTCHANNEL"category,Config.text_channelwhich uses theConfigCategory.TEXT_CHANNEL = "ACTUALTEXTCHANNEL"category, andConfig.voice_channelwhich uses theConfigCategory.VOICE_CHANNEL = "VOICECHANNEL"categoryIt's ugly, but it's unlikely to bother many cog devs. Perhaps we could look into migrating "TEXTCHANNEL" to "CHANNEL" silently to mitigate the ugliness.
Edit: I forgot about category channels but you get the picture ;)
I think I'd prefer deprecating global key use to prevent this sort of issue from being reoccuring (Named custom groups with 0 identifiers will work identically well) or changing how global keys are accessed
config.get_globalor something else like that.But yes, that would be the breakage.
closing this, it's rehashed in the config2 discussion better than here.