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

Adds approx guild count and get self application endpoint #5971

Merged
merged 7 commits into from
Jul 13, 2023

Conversation

Jupith
Copy link
Contributor

@Jupith Jupith commented Mar 2, 2023

No description provided.

@@ -19,11 +19,13 @@
| summary *(deprecated)* | string | **deprecated and will be removed in v11.** An empty string. |
| verify_key | string | the hex encoded key for verification in interactions and the GameSDK's [GetTicket](#DOCS_GAME_SDK_APPLICATIONS/getticket) |
| team | ?[team](#DOCS_TOPICS_TEAMS/data-models-team-object) object | if the application belongs to a team, this will be a list of the members of that team |
| guild_id? | snowflake | if this application is a game sold on Discord, this field will be the guild to which it has been linked |
| guild_id? | snowflake | guild associated with the bot. For example a developer support server. |
Copy link
Contributor

@splatterxl splatterxl Mar 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| guild_id? | snowflake | guild associated with the bot. For example a developer support server. |
| guild_id? | snowflake | guild associated with the bot, e.g. a developer support server |

| primary_sku_id? | snowflake | if this application is a game sold on Discord, this field will be the id of the "Game SKU" that is created, if exists |
| slug? | string | if this application is a game sold on Discord, this field will be the URL slug that links to the store page |
| cover_image? | string | the application's default rich presence invite [cover image hash](#DOCS_REFERENCE/image-formatting) |
| flags? | integer | the application's public [flags](#DOCS_RESOURCES_APPLICATION/application-object-application-flags) |
| approximate_guild_count? | integer | an approximate count of the bots guild membership. |
Copy link
Contributor

@splatterxl splatterxl Mar 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| approximate_guild_count? | integer | an approximate count of the bots guild membership. |
| approximate_guild_count? | integer | an approximate count of the guilds the bot was added to |

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"an application" doesn't really match the rest, it should be "the application", like how the current docs say "the bots"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

either way it's not a count of app membership, just bot.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe something like an approximate count of the guilds the bot was added to

@@ -94,3 +96,7 @@
| ----------- | ---------------- | ---------------------------------------------------------------------------------------------------------- |
| scopes | array of strings | the [scopes](#DOCS_TOPICS_OAUTH2/shared-resources-oauth2-scopes) to add the application to the server with |
| permissions | string | the [permissions](#DOCS_TOPICS_PERMISSIONS) to request for the bot role |

## Get Current Bot Application Information % GET /applications/@me
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there, what is going to happen to the /oauth2/applications/@me route? Is it still going to be supported, or is it going to be deprecated and eventually replaced with this route?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing changes here. It was just not documented.

Co-authored-by: IllagerCaptain <76600137+IllagerCaptain@users.noreply.github.com>
@Misha-133
Copy link
Contributor

Misha-133 commented Mar 2, 2023

What about redirect_uris (array of string) and interactions_endpoint_url (string) properties? They are also returned on this endpoint. Shouldn't these be documented too?

After doing some more research it seems like this endpoint also returns a partial guild object if one is linked as a support server for the bot

Also bot_public and bot_require_code_grant should be marked as optionals since they are not returned

@Jupith
Copy link
Contributor Author

Jupith commented Mar 3, 2023

What about redirect_uris (array of string) and interactions_endpoint_url (string) properties? They are also returned on this endpoint. Shouldn't these be documented too?

I can document those aswell sure, the endpoint actually supports PATCH, these 2 are params.

After doing some more research it seems like this endpoint also returns a partial guild object if one is linked as a support server for the bot

I included this

Also bot_public and bot_require_code_grant should be marked as optionals since they are not returned

👍

@Misha-133
Copy link
Contributor

Misha-133 commented Mar 3, 2023

I included this

Ah, yup, sorry. I've completely missed it

I can document those aswell sure, the endpoint actually supports PATCH, these 2 are params.

huh, setting redirect_uris doesn't seem to change anything

interactions_endpoint_url and role_connections_verification_url change without issues tho
description changes as well

@Jupith
Copy link
Contributor Author

Jupith commented Mar 3, 2023

huh, setting redirect_uris doesn't seem to change anything

Oh yeah, i got confused because they still validate it, so it looks settable :husk:

@Lulalaby
Copy link
Contributor

Lulalaby commented Mar 3, 2023

huh, setting redirect_uris doesn't seem to change anything

Oh yeah, i got confused because they still validate it, so it looks settable :husk:

So is it settable or not 😅

@Jupith
Copy link
Contributor Author

Jupith commented Mar 3, 2023

If your a user yea, but not for bots

@IllagerCaptain
Copy link
Contributor

If your a user yea, but not for bots

I'm assuming this is for user security w/ OAuth2 in the case of a token leak?

@Lulalaby
Copy link
Contributor

Lulalaby commented Mar 3, 2023

If your a user yea, but not for bots

Ah yeah, tested it, thanks for the clarification

@Misha-133
Copy link
Contributor

So it appears that you can also modify application's tags
and each tag has a max length of 20.

And also you can edit icon with a base64 encoded image

@Puncher1
Copy link
Contributor

Puncher1 commented Mar 9, 2023

For me the response doesn't have the approximate_guild_count field.

Repro:

import aiohttp
import asyncio
import os

from dotenv import load_dotenv

load_dotenv()


TOKEN = os.getenv("BOT_TOKEN")
BASE = "https://discord.com/api/v10"
HEADERS = {
    'User-Agent': 'DiscordBot (https://github.com/puncher1, 1) Python/3.8 aiohttp/3.8.4',
    'Authorization': f'Bot {TOKEN}',
    'Content-Type': 'application/json'
}

async def request(method, url, **kwargs):
    session = aiohttp.ClientSession()
    async with session.request(method, url, **kwargs) as response:
        text = await response.text(encoding='utf-8')
        print(text)


def get_appinfo():
    method = "GET"
    url =f"{BASE}/oauth2/applications/@me"
    kwargs = {'headers': HEADERS,}

    asyncio.run(request(method, url, **kwargs))

get_appinfo()

@Lulalaby
Copy link
Contributor

Lulalaby commented Mar 9, 2023

Fyi the apps @me endpoint is missing important data like teams and owner.

Should not be used as replacement for the oauth route.

@advaith1
Copy link
Contributor

advaith1 commented Mar 9, 2023

@Puncher1 /oauth2/applications/@me and /applications/@me are different endpoints

@Puncher1
Copy link
Contributor

Puncher1 commented Mar 9, 2023

@advaith1 Ah alright. Can you send me a link to the documentation? I can only find GET /oauth2/applications/@me

@advaith1
Copy link
Contributor

advaith1 commented Mar 9, 2023

It is not released yet so it is intentionally not documented yet. The point of this PR is to document it

@Puncher1
Copy link
Contributor

Puncher1 commented Mar 9, 2023

@advaith1 Ah okay, thanks for clarity. I thought it's only related to /oauth2/applications/@me. So applications/@me is a partial application info?


## Get Current Bot Application Information % GET /applications/@me

Returns the bot's [application](#DOCS_RESOURCES_APPLICATION/application-object) object.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would add a note that the info returned from this endpoint is partial/different from the oauth2 route

Copy link
Contributor

@shaydewael shaydewael left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

standardizing on app since it's Application object 😅

docs/resources/Application.md Outdated Show resolved Hide resolved
docs/resources/Application.md Outdated Show resolved Hide resolved
docs/resources/Application.md Outdated Show resolved Hide resolved
docs/resources/Application.md Outdated Show resolved Hide resolved
Jupith and others added 4 commits July 13, 2023 20:30
Co-authored-by: shay <swdewael@gmail.com>
Co-authored-by: shay <swdewael@gmail.com>
Co-authored-by: shay <swdewael@gmail.com>
Co-authored-by: shay <swdewael@gmail.com>
@shaydewael shaydewael merged commit 0817246 into discord:main Jul 13, 2023
2 checks passed
Nihlus added a commit to Remora/Remora.Discord that referenced this pull request Jul 14, 2023
lukellmann added a commit to lukellmann/kord that referenced this pull request Sep 28, 2023
shaydewael added a commit to Jupith/discord-api-docs that referenced this pull request May 14, 2024
* Add endpoint

* Add new fields

* Update docs/resources/Application.md

Co-authored-by: IllagerCaptain <76600137+IllagerCaptain@users.noreply.github.com>

* Update docs/resources/Application.md

Co-authored-by: shay <swdewael@gmail.com>

* Update docs/resources/Application.md

Co-authored-by: shay <swdewael@gmail.com>

* Update docs/resources/Application.md

Co-authored-by: shay <swdewael@gmail.com>

* Update docs/resources/Application.md

Co-authored-by: shay <swdewael@gmail.com>

---------

Co-authored-by: IllagerCaptain <76600137+IllagerCaptain@users.noreply.github.com>
Co-authored-by: shay <swdewael@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants