Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More privatization, and some error helpers #2976

Merged
merged 6 commits into from Sep 26, 2019
Merged

More privatization, and some error helpers #2976

merged 6 commits into from Sep 26, 2019

Conversation

mikeshardmind
Copy link
Contributor

@mikeshardmind mikeshardmind commented Sep 1, 2019

Type

  • Bugfix
  • Enhancement
  • New feature

Description of the changes

This makes a lot more things private. Continued from #2967, fixes #2984
Adds public methods for various things.

Below is a brief summary of things available elsewhere, though this
particular set of changes may warrant a detailed section in the release notes.

  • bot.db.locale -> redbot.core.i18n.get_locale

    • Note: This one already existed.
  • bot.db.help -> redbot.core.commands.help.HelpSettings

  • bot db whitelist/blacklist? -> bot.allowed_by_whitelist_blacklist

    • This has also been made a single canonical function for this purpose including check usage
  • bot color? -> bot.get_embed_color/bot.get_embed_colour

  • bot.id.api_tokens? ->

    • bot.get_shared_api_tokens
    • bot.set_shared_api_tokens
    • bot.remove_shared_api_tokens

-bot.db.prefix -> bot.get_valid_prefixes

  • (Note: This is a wrapper around bot.get_prefix)

Other changes include

  • removing bot.counter as it was never used anywhere
  • Adding properties with helpful error messages for moved and renamed things
  • making bot.uptime a property with an error on set
  • adding a migration to the bot config for shared_api_tokens
  • fixing a couple prior missed bot.db -> bot._config uses

@mikeshardmind mikeshardmind added the Breaking Change label Sep 1, 2019
@mikeshardmind mikeshardmind added this to the 3.2.0 milestone Sep 1, 2019
@mikeshardmind mikeshardmind requested a review from Tobotimus Sep 1, 2019
@Flame442 Flame442 added the Type: Enhancement label Sep 2, 2019
@mikeshardmind
Copy link
Contributor Author

@mikeshardmind mikeshardmind commented Sep 7, 2019

After some feedback from various cog creators in the discord server, there should be a few more things exposed in this PR prior to it being merged.

Will be adding those soon™️

@mikeshardmind
Copy link
Contributor Author

@mikeshardmind mikeshardmind commented Sep 8, 2019

This now has all the changes planned for this PR.

Some of the attributes related to help formatting should also be exposed, but this should be done with the design concerns of #2981 in mind, likely as part of those changes.

redbot/core/bot.py Outdated Show resolved Hide resolved
@mikeshardmind mikeshardmind added Blocked By: Damage Control and removed Blocked By: Damage Control labels Sep 13, 2019
This makes a lot more things private. Continued from #2967, fixes #2984
Adds public methods for various things.

Below is a brief summary of things available elsewhere, though this
particular set of changes may warrant a detailed section in the release notes.

 - bot.db.locale -> redbot.core.i18n.get_locale
   - Note: This one already existed.
 - bot.db.help -> redbot.core.commands.help.HelpSettings
 - bot db whitelist/blaclist? -> bot.allowed_by_whitelist_blacklist
   - This has also been made a single cannonical function for this
   purpose including check usage
 - bot color? -> bot.get_embed_color/bot.get_embed_colour
 - bot.id.api_tokens? ->

   - bot.get_shared_api_tokens
   - bot.set_shared_api_tokens
   - bot.remove_shared_api_tokens

 -bot.db.prefix -> bot.get_valid_prefixes
   - (Note: This is a wrapper around bot.get_prefix)

 Other changes include
  - removing `bot.counter` as it was never used anywhere
  - Adding properties with helpful error messages for moved and renamed
  things
  - making bot.uptime a property with an error on set
  - adding a migration to the bot config for shared_api_tokens
Copy link
Member

@Flame442 Flame442 left a comment

Everything appears to work but I didn't do extensive edge case testing nor do I understand the internals to see any implications of these changes. I've included some recommendations for some changes to docstrings and other UX.

redbot/core/bot.py Outdated Show resolved Hide resolved
redbot/core/bot.py Show resolved Hide resolved
redbot/core/bot.py Outdated Show resolved Hide resolved
redbot/core/bot.py Show resolved Hide resolved
redbot/core/bot.py Show resolved Hide resolved
redbot/core/bot.py Show resolved Hide resolved
redbot/core/bot.py Show resolved Hide resolved
@Flame442 Flame442 added QA: Passed and removed QA: Needed labels Sep 26, 2019
Copy link
Collaborator

@Cog-CreatorsBot Cog-CreatorsBot left a comment

Approved by Flame#2941

@mikeshardmind mikeshardmind merged commit 2561462 into Cog-Creators:V3/develop Sep 26, 2019
1 check passed
@DevilXD
Copy link
Contributor

@DevilXD DevilXD commented Sep 28, 2019

It's kinda too late, but is this file supposed to be there? Doesn't it belong in the changelog folder?
https://github.com/Cog-Creators/Red-DiscordBot/blob/V3/develop/redbot/core/2976.feature.rst

EDIT: Nvm, I just saw #3019

@mikeshardmind mikeshardmind deleted the continuing-private-attrs branch Dec 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Breaking Change QA: Passed Type: Enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants