1
|
|
|
# -*- coding: utf-8 -*- |
|
|
|
|
2
|
|
|
# MIT License |
3
|
|
|
# |
4
|
|
|
# Copyright (c) 2021 Pincer |
5
|
|
|
# |
6
|
|
|
# Permission is hereby granted, free of charge, to any person obtaining |
7
|
|
|
# a copy of this software and associated documentation files |
8
|
|
|
# (the "Software"), to deal in the Software without restriction, |
9
|
|
|
# including without limitation the rights to use, copy, modify, merge, |
10
|
|
|
# publish, distribute, sublicense, and/or sell copies of the Software, |
11
|
|
|
# and to permit persons to whom the Software is furnished to do so, |
12
|
|
|
# subject to the following conditions: |
13
|
|
|
# |
14
|
|
|
# The above copyright notice and this permission notice shall be |
15
|
|
|
# included in all copies or substantial portions of the Software. |
16
|
|
|
# |
17
|
|
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
18
|
|
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
19
|
|
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
20
|
|
|
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
21
|
|
|
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
22
|
|
|
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
23
|
|
|
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
24
|
|
|
from __future__ import annotations |
25
|
|
|
|
26
|
|
|
from dataclasses import dataclass |
27
|
|
|
from typing import Optional, List |
28
|
|
|
|
29
|
|
|
from pincer.utils.api_object import APIObject |
30
|
|
|
|
31
|
|
|
from pincer.objects.user import User |
32
|
|
|
from pincer.utils.constants import APINullable, MISSING |
33
|
|
|
from pincer.utils.snowflake import Snowflake |
34
|
|
|
|
35
|
|
|
|
36
|
|
|
@dataclass |
|
|
|
|
37
|
|
|
class Application(APIObject): |
38
|
|
|
""" |
39
|
|
|
Represents a Discord application. (eg Bot, OAuth) |
40
|
|
|
|
41
|
|
|
:param bot_public: |
42
|
|
|
when false only app owner can join the app's bot to guilds |
43
|
|
|
|
44
|
|
|
:param bot_require_code_grant: |
45
|
|
|
when true the app's bot will only join upon completion of the |
46
|
|
|
full oauth2 code grant flow |
47
|
|
|
|
48
|
|
|
:param description: |
49
|
|
|
the description of the app |
50
|
|
|
|
51
|
|
|
:param id: |
52
|
|
|
the id of the app |
53
|
|
|
|
54
|
|
|
:param icon: |
55
|
|
|
the icon hash of the app |
56
|
|
|
|
57
|
|
|
:param name: |
58
|
|
|
the name of the app |
59
|
|
|
|
60
|
|
|
:param privacy_policy_url: |
61
|
|
|
the url of the app's privacy policy |
62
|
|
|
|
63
|
|
|
:param summary: |
64
|
|
|
if this application is a game sold on Discord, this field will be the |
65
|
|
|
summary field for the store page of its primary sku |
66
|
|
|
|
67
|
|
|
:param verify_key: |
68
|
|
|
the hex encoded key for verification in interactions and the GameSDK's |
69
|
|
|
GetTicket |
70
|
|
|
|
71
|
|
|
:param cover_image: |
72
|
|
|
the application's default rich presence invite cover image hash |
73
|
|
|
|
74
|
|
|
:param flags: |
75
|
|
|
the application's public flags |
76
|
|
|
|
77
|
|
|
:param guild_id: |
78
|
|
|
if this application is a game sold on Discord, this field will be the |
79
|
|
|
guild to which it has been linked |
80
|
|
|
|
81
|
|
|
:param owner: |
82
|
|
|
partial user object containing info on the owner of the application |
83
|
|
|
|
84
|
|
|
:param primary_sku_id: |
85
|
|
|
if this application is a game sold on Discord, this field will be the |
86
|
|
|
id of the "Game SKU" that is created, if exists |
87
|
|
|
|
88
|
|
|
:param rpc_origins: |
89
|
|
|
an array of rpc origin urls, if rpc is enabled |
90
|
|
|
|
91
|
|
|
:param slug: |
92
|
|
|
if this application is a game sold on Discord, this field will be the |
93
|
|
|
URL slug that links to the store page |
94
|
|
|
|
95
|
|
|
:param terms_of_service_url: |
96
|
|
|
the url of the app's terms of service |
97
|
|
|
""" |
98
|
|
|
|
99
|
|
|
bot_public: bool |
100
|
|
|
bot_require_code_grant: bool |
101
|
|
|
description: str |
102
|
|
|
id: Snowflake |
|
|
|
|
103
|
|
|
icon: Optional[str] |
104
|
|
|
name: str |
105
|
|
|
privacy_policy_url: APINullable[str] |
|
|
|
|
106
|
|
|
summary: str |
107
|
|
|
verify_key: str |
108
|
|
|
|
109
|
|
|
cover_image: APINullable[str] = MISSING |
|
|
|
|
110
|
|
|
flags: APINullable[int] = MISSING |
|
|
|
|
111
|
|
|
guild_id: APINullable[Snowflake] = MISSING |
|
|
|
|
112
|
|
|
owner: APINullable[User] = MISSING |
|
|
|
|
113
|
|
|
primary_sku_id: APINullable[Snowflake] = MISSING |
|
|
|
|
114
|
|
|
rpc_origins: APINullable[List[str]] = MISSING |
|
|
|
|
115
|
|
|
slug: APINullable[str] = MISSING |
|
|
|
|
116
|
|
|
terms_of_service_url: APINullable[str] = MISSING |
|
|
|
|
117
|
|
|
|