[V3 Mod] Support global users with userinfo #2282
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 milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Mrcoolgamer11/Red-DiscordBot!2282
Loading…
Reference in a new issue
No description provided.
Delete branch "patch-26"
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
The
[p]userinfocommand can now fetch informations about any Discord user, even if he doesn't share a server with the bot, using thebot.get_user_info(ID)endpoint.Example
get_user_infoisn't likeget_memberand the like - if the user ID is not found, it raises a 404 Not Found error (specificallydiscord.NotFound) instead of returningNone.It's also worth noting that there's a
get_usermethod ofbot, which will fetch the user from the bot's global cache of connected users. It may be worth checking that before usingget_user_info.Forbiddenis a 403 error. You want to catchNotFound, a 404 error, as per my last comment.Considering the ratelimits that endpoint is subject to, I think this belongs in a separate command which isn't available to all users.
How about allowing cache access (
get_user) for anyone but only allowingget_user_infoif it's the bot owner?I'd feel more comfortable with only allowing to look up the member from the cache if the the person the author is looking up has a mutual server with him. This avoids the issue of trying to brute force information on public Red bots if we ever decide to add more information to userinfo
I've given this a little more thought as well. Rather than expand
userinfoin this manner, I think it is appropriate to add afindusercommand.The following internal filtering would need to occur in such a command:
If the user is in bot.users:
If any of the guilds are mutually shared between the bot, queried user, and author, allow the info.
If the author is the bot owner, allow the info
Otherwise, don't share the info
If the user is not in bot.users
Allow only to the owner.
Additionally, this lookup should use
redbot.core.utils.antispam(Not a straight cooldown) to limit this commands repeated usability to non-bot owners.@mikeshardmind good idea, but should this stay inside the mod cog?
@retke I think so, this has very little practical purpose outside of moderation. I'm open to the new command being placed elsewhere with a logical reason for doing so though.
I've pushed a sample implementation of this command into a
stagingcog on my cog repo.I'll PR this to exist within core mod if the implementation here looks reasonable enough for general use.
Source
Will be rewritten into a new command.
Pull request closed