Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Application): application flags (#5147)
Co-authored-by: SpaceEEC <spaceeec@yahoo.com> Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
- Loading branch information
1 parent
dedf432
commit 06e9d86
Showing
9 changed files
with
147 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,27 @@ | ||
'use strict'; | ||
|
||
const ClientApplication = require('../../../structures/ClientApplication'); | ||
let ClientUser; | ||
|
||
module.exports = (client, { d: data }, shard) => { | ||
if (client.user) { | ||
client.user._patch(data.user); | ||
} else { | ||
if (!ClientUser) ClientUser = require('../../../structures/ClientUser'); | ||
const clientUser = new ClientUser(client, data.user); | ||
client.user = clientUser; | ||
client.users.cache.set(clientUser.id, clientUser); | ||
client.user = new ClientUser(client, data.user); | ||
client.users.cache.set(client.user.id, client.user); | ||
} | ||
|
||
for (const guild of data.guilds) { | ||
guild.shardID = shard.id; | ||
client.guilds.add(guild); | ||
} | ||
|
||
if (client.application) { | ||
client.application._patch(data.application); | ||
} else { | ||
client.application = new ClientApplication(client, data.application); | ||
} | ||
|
||
shard.checkReady(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
'use strict'; | ||
|
||
const BitField = require('./BitField'); | ||
|
||
/** | ||
* Data structure that makes it easy to interact with a {@link ClientApplication#flags} bitfield. | ||
* @extends {BitField} | ||
*/ | ||
class ApplicationFlags extends BitField {} | ||
|
||
/** | ||
* @name ApplicationFlags | ||
* @kind constructor | ||
* @memberof ApplicationFlags | ||
* @param {BitFieldResolvable} [bits=0] Bit(s) to read from | ||
*/ | ||
|
||
/** | ||
* Bitfield of the packed bits | ||
* @type {number} | ||
* @name ApplicationFlags#bitfield | ||
*/ | ||
|
||
/** | ||
* Numeric application flags. All available properties: | ||
* * `MANAGED_EMOJI` | ||
* * `GROUP_DM_CREATE` | ||
* * `RPC_HAS_CONNECTED` | ||
* * `GATEWAY_PRESENCE` | ||
* * `FATEWAY_PRESENCE_LIMITED` | ||
* * `GATEWAY_GUILD_MEMBERS` | ||
* * `GATEWAY_GUILD_MEMBERS_LIMITED` | ||
* * `VERIFICATION_PENDING_GUILD_LIMIT` | ||
* * `EMBEDDED` | ||
* @type {Object} | ||
*/ | ||
ApplicationFlags.FLAGS = { | ||
MANAGED_EMOJI: 1 << 2, | ||
GROUP_DM_CREATE: 1 << 4, | ||
RPC_HAS_CONNECTED: 1 << 11, | ||
GATEWAY_PRESENCE: 1 << 12, | ||
GATEWAY_PRESENCE_LIMITED: 1 << 13, | ||
GATEWAY_GUILD_MEMBERS: 1 << 14, | ||
GATEWAY_GUILD_MEMBERS_LIMITED: 1 << 15, | ||
VERIFICATION_PENDING_GUILD_LIMIT: 1 << 16, | ||
EMBEDDED: 1 << 17, | ||
}; | ||
|
||
module.exports = ApplicationFlags; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters