[Core] Adding Team support #2781

Closed
opened 2019-06-21 04:06:25 +02:00 by Kowlin · 5 comments
Kowlin commented 2019-06-21 04:06:25 +02:00 (Migrated from github.com)

Discord has recently added support to pull the team members via the endpoint GET discordapp.com/api/v7/oauth/applications/@me. (see sample output below) I'm interested in adding this behavior into Red but I'm now sure on how ever I want to go at it. So far I've come up with 2 possible ideas to allow team support.

  1. We directly add in all team members to the co_owners field within Red at boot up, or
  2. Once the bot has the --team flag enabled, we will then add in the team members to the co_owners field. This will ensure that there is an explicit opt-in for team support.

Beyond the first issue of adding in new co-owners to teams. We'd also need to update the info command to reflect that its being hosted on a team. Which we can now do. Such as listing the "Instance owned by" field as "Team Red-DiscordBot"

EDIT: Forgot JSON sample >.<

{
    "description": "",
    "name": "Lars",
    "team": {
        "owner_user_id": "142006827155062784",
        "members": [
            {
                "membership_state": 2,
                "team_id": "532230556675604482",
                "user": {
                    "username": "Tense",
                    "discriminator": "6198",
                    "id": "96742984233525248",
                    "avatar": "780c330743cc20ec14458383e9af037e"
                },
                "permissions": [
                    "*"
                ]
            },
            {
                "membership_state": 2,
                "team_id": "532230556675604482",
                "user": {
                    "username": "Kowlin",
                    "discriminator": "2536",
                    "id": "57287406247743488",
                    "avatar": "a_a3b9a3de2c74bfb0cb138e99c9b08a89"
                },
                "permissions": [
                    "*"
                ]
            },
            {
                "membership_state": 2,
                "team_id": "532230556675604482",
                "user": {
                    "username": "Flak",
                    "discriminator": "0001",
                    "id": "167354221190971392",
                    "avatar": "06834be37c453d1dd08cccd22fbae411"
                },
                "permissions": [
                    "*"
                ]
            },
            {
                "membership_state": 2,
                "team_id": "532230556675604482",
                "user": {
                    "username": "Soulrift",
                    "discriminator": "0001",
                    "id": "142006827155062784",
                    "avatar": "a_42055826f952fd72e62aacf7d53d54e9"
                },
                "permissions": [
                    "*"
                ]
            }
        ],
        "id": "532230556675604482",
        "name": "Fortnite Moderators",
        "icon": "799e3fdc1c6df26fd321d181129e5648"
    },
    "bot_require_code_grant": false,
    "summary": "",
    "verify_key": "a601f0b5001042125f06ccdaa99f5cfb16163dbe09a98ee8aec512c0a489048c",
    "owner": {
        "username": "team532230556675604482",
        "discriminator": "0000",
        "flags": 1024,
        "id": "532230556675604482",
        "avatar": null
    },
    "bot_public": false,
    "id": "575017721797017644",
    "icon": null
}```
Discord has recently added support to pull the team members via the endpoint ``GET discordapp.com/api/v7/oauth/applications/@me``. (see sample output below) I'm interested in adding this behavior into Red but I'm now sure on how ever I want to go at it. So far I've come up with 2 possible ideas to allow team support. 1. We directly add in all team members to the ``co_owners`` field within Red at boot up, or 2. Once the bot has the ``--team`` flag enabled, we will then add in the team members to the ``co_owners`` field. This will ensure that there is an explicit opt-in for team support. Beyond the first issue of adding in new co-owners to teams. We'd also need to update the ``info`` command to reflect that its being hosted on a team. Which we can now do. Such as listing the "Instance owned by" field as "Team Red-DiscordBot" EDIT: Forgot JSON sample >.< ```json { "description": "", "name": "Lars", "team": { "owner_user_id": "142006827155062784", "members": [ { "membership_state": 2, "team_id": "532230556675604482", "user": { "username": "Tense", "discriminator": "6198", "id": "96742984233525248", "avatar": "780c330743cc20ec14458383e9af037e" }, "permissions": [ "*" ] }, { "membership_state": 2, "team_id": "532230556675604482", "user": { "username": "Kowlin", "discriminator": "2536", "id": "57287406247743488", "avatar": "a_a3b9a3de2c74bfb0cb138e99c9b08a89" }, "permissions": [ "*" ] }, { "membership_state": 2, "team_id": "532230556675604482", "user": { "username": "Flak", "discriminator": "0001", "id": "167354221190971392", "avatar": "06834be37c453d1dd08cccd22fbae411" }, "permissions": [ "*" ] }, { "membership_state": 2, "team_id": "532230556675604482", "user": { "username": "Soulrift", "discriminator": "0001", "id": "142006827155062784", "avatar": "a_42055826f952fd72e62aacf7d53d54e9" }, "permissions": [ "*" ] } ], "id": "532230556675604482", "name": "Fortnite Moderators", "icon": "799e3fdc1c6df26fd321d181129e5648" }, "bot_require_code_grant": false, "summary": "", "verify_key": "a601f0b5001042125f06ccdaa99f5cfb16163dbe09a98ee8aec512c0a489048c", "owner": { "username": "team532230556675604482", "discriminator": "0000", "flags": 1024, "id": "532230556675604482", "avatar": null }, "bot_public": false, "id": "575017721797017644", "icon": null }```
Zephyrkul commented 2019-06-21 04:53:38 +02:00 (Migrated from github.com)

I'd assume d.py would figure out team support upstream, and things like the bot's is_owner coro would be updated to reflect this new feature. We should see how d.py handles this, since it could mess up ratelimits and the like if we access the API directly, and since it's likely to include team support in methods our bot class inherits or calls.

I'd assume d.py would figure out team support upstream, and things like the bot's is_owner coro would be updated to reflect this new feature. We should see how d.py handles this, since it could mess up ratelimits and the like if we access the API directly, and since it's likely to include team support in methods our bot class inherits or calls.
Rapptz commented 2019-06-21 05:32:18 +02:00 (Migrated from github.com)

Support for teams will probably not be backported to 1.2.x (since it requires adding new attributes). It'll probably be in 1.3.

I was thinking of adding it in a patch bump so it'll be in the 1.2.3 version that is currently blocking #2769 but since it murks up the versioning scheme I decided against.

Support for teams will probably not be backported to 1.2.x (since it requires adding new attributes). It'll probably be in 1.3. I was thinking of adding it in a patch bump so it'll be in the 1.2.3 version that is currently blocking #2769 but since it murks up the versioning scheme I decided against.
mikeshardmind commented 2019-06-21 13:05:37 +02:00 (Migrated from github.com)

I'm fine with waiting on full support for it to be added upstream. Our current team users should already be using the coowner flag for now, so we don't lose anything to wait.

I'm fine with waiting on full support for it to be added upstream. Our current team users should already be using the coowner flag for now, so we don't lose anything to wait.
LGACode commented 2020-01-10 04:38:47 +01:00 (Migrated from github.com)

Is this the proper place to also report that !info does not correctly display Teams as the owner? It shows the Team ID instead of the actual Team name:

image

Is this the proper place to also report that !info does not correctly display Teams as the owner? It shows the Team ID instead of the actual Team name: ![image](https://user-images.githubusercontent.com/6125912/72123887-05f2f500-3320-11ea-9c39-0dfff3a48d94.png)
mikeshardmind commented 2020-01-10 04:39:31 +01:00 (Migrated from github.com)

Yep, thanks for the info, we'll be looking into handling this when we add team support too.

Yep, thanks for the info, we'll be looking into handling this when we add team support too.
Sign in to join this conversation.
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
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Mrcoolgamer11/Red-DiscordBot#2781
No description provided.