@@ -15,7 +15,7 @@ const Permissions = require('../util/Permissions');
1515 */
1616
1717/**
18- * Represents a Client OAuth2 Application .
18+ * Represents a client application .
1919 * @extends {Application }
2020 */
2121class ClientApplication extends Application {
@@ -69,6 +69,26 @@ class ClientApplication extends Application {
6969 this . flags = new ApplicationFlags ( data . flags ) . freeze ( ) ;
7070 }
7171
72+ if ( 'approximate_guild_count' in data ) {
73+ /**
74+ * An approximate amount of guilds this application is in.
75+ * @type {?number }
76+ */
77+ this . approximateGuildCount = data . approximate_guild_count ;
78+ } else {
79+ this . approximateGuildCount ??= null ;
80+ }
81+
82+ if ( 'guild_id' in data ) {
83+ /**
84+ * The id of the guild associated with this application.
85+ * @type {?Snowflake }
86+ */
87+ this . guildId = data . guild_id ;
88+ } else {
89+ this . guildId ??= null ;
90+ }
91+
7292 if ( 'cover_image' in data ) {
7393 /**
7494 * The hash of the application's cover image
@@ -120,6 +140,15 @@ class ClientApplication extends Application {
120140 : this . owner ?? null ;
121141 }
122142
143+ /**
144+ * The guild associated with this application.
145+ * @type {?Guild }
146+ * @readonly
147+ */
148+ get guild ( ) {
149+ return this . client . guilds . cache . get ( this . guildId ) ?? null ;
150+ }
151+
123152 /**
124153 * Whether this application is partial
125154 * @type {boolean }
@@ -134,8 +163,8 @@ class ClientApplication extends Application {
134163 * @returns {Promise<ClientApplication> }
135164 */
136165 async fetch ( ) {
137- const app = await this . client . api . oauth2 . applications ( '@me' ) . get ( ) ;
138- this . _patch ( app ) ;
166+ const data = await this . client . api . applications ( '@me' ) . get ( ) ;
167+ this . _patch ( data ) ;
139168 return this ;
140169 }
141170
0 commit comments