mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 16:43:31 +01:00
feat: stage channels (#5456)
* feat: add stage channel type * feat: initialise stage channel structure * feat: add STAGE_MODERATOR permissions bitfield * fix: typo in permissions * fix(Channel): type selection logic * feat: add rtcRegion to StageChannel and VoiceChannel * feat: rtc region editing for stage and voice channels * feat: stage channel userLimit * feat: add stage channels to exports * feat: add computed properties to stage channel * feat(VoiceState): include stage channel in docs * feat: allow ability to join stage channels * feat(StageChannel): join and leave methods * docs: add StageChannel link in GuildChannel docs * feat(VoiceState): suppress and requestToSpeakTimestamp * feat(StageChannel): setRequestToSpeak * refactor(StageChannel): update setRequestToSpeak * feat(VoiceState): add moveToSpeakers and moveToAudience * feat(VoiceState): add methods to move in/out of speakers * feat(VoiceState): add stage channel sanity checks * feat(Permissions): add REQUEST_TO_SPEAK * feat(VoiceState): simpler methods * docs(VoiceState): add documentation for new methods * refactor: remove unused error message * chore: remove debug statements * chore: revert changes to package-lock.json * docs(VoiceState): clarify suppress * docs(VoiceState): add missing @type param * feat(StageChannel): remove nsfw property * fix(VoiceState): check permissions in channel Co-authored-by: Advaith <advaithj1@gmail.com> * fix(VoiceState): instantiate error with new Co-authored-by: BannerBomb <BannerBomb55@gmail.com> * refactor(VoiceState): more readable API route builder Co-authored-by: Sugden <28943913+NotSugden@users.noreply.github.com> * style(VoiceState): fix lint errors * docs(VoiceState): add example usage for new methods * docs: setRTCRegion examples * chore: update typings * fix(VoiceState): calculate permissions for self * refactor(VoiceState): tidy up implementation * Update src/structures/VoiceState.js Co-authored-by: Jan <66554238+vaporox@users.noreply.github.com> * refactor: vaporox's suggestions * style(VoiceState): fix linter errors * chore: update typings * chore: remove unused error message * refactor(VoiceState): use optional chaining Co-authored-by: Sugden <28943913+NotSugden@users.noreply.github.com> * chore: move getters below constructor in typings * refactor(StageChannel): optional chaining Co-authored-by: Sugden <28943913+NotSugden@users.noreply.github.com> * style(VoiceState): fix lint errors * docs: fix incorrect types Co-authored-by: izexi <43889168+izexi@users.noreply.github.com> * Update src/structures/VoiceChannel.js Co-authored-by: izexi <43889168+izexi@users.noreply.github.com> * Update src/structures/VoiceChannel.js Co-authored-by: izexi <43889168+izexi@users.noreply.github.com> * refactor(VoiceState): use optional chaining Co-authored-by: Sugden <28943913+NotSugden@users.noreply.github.com> * refactor(StageChannel): remove permission override check in joinable * refactor: make ChannelTypes a proper enum * Use createEnum Co-authored-by: izexi <43889168+izexi@users.noreply.github.com> * chore: remove unused code from Constants * refactor(StageChannel): remove unnecessary getters * chore: update typings * refactor: introduce BaseGuildVoiceChannel class * refactor(VoiceChannel): reduce code duplication * feat: export BaseGuildVoiceChannel * chore: update typings * docs: fix typos * refactor: move setRTCRegion to BaseGuildVoiceChannel * feat(VoiceState): remove permission checks * chore: update typings * Apply suggestions from code review Co-authored-by: Sugden <28943913+NotSugden@users.noreply.github.com> Co-authored-by: Jan <66554238+vaporox@users.noreply.github.com> * chore: update esm exports and typings * Update src/structures/VoiceState.js Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com> Co-authored-by: Advaith <advaithj1@gmail.com> Co-authored-by: BannerBomb <BannerBomb55@gmail.com> Co-authored-by: Sugden <28943913+NotSugden@users.noreply.github.com> Co-authored-by: Jan <66554238+vaporox@users.noreply.github.com> Co-authored-by: izexi <43889168+izexi@users.noreply.github.com> Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
This commit is contained in:
@@ -477,15 +477,19 @@ exports.SystemMessageTypes = exports.MessageTypes.filter(type => type && type !=
|
||||
*/
|
||||
exports.ActivityTypes = ['PLAYING', 'STREAMING', 'LISTENING', 'WATCHING', 'CUSTOM_STATUS', 'COMPETING'];
|
||||
|
||||
exports.ChannelTypes = {
|
||||
TEXT: 0,
|
||||
DM: 1,
|
||||
VOICE: 2,
|
||||
GROUP: 3,
|
||||
CATEGORY: 4,
|
||||
NEWS: 5,
|
||||
STORE: 6,
|
||||
};
|
||||
exports.ChannelTypes = createEnum([
|
||||
'TEXT',
|
||||
'DM',
|
||||
'VOICE',
|
||||
'GROUP',
|
||||
'CATEGORY',
|
||||
'NEWS',
|
||||
// 6
|
||||
'STORE',
|
||||
...Array(6).fill(null),
|
||||
// 13
|
||||
'STAGE',
|
||||
]);
|
||||
|
||||
exports.ClientApplicationAssetTypes = {
|
||||
SMALL: 1,
|
||||
|
||||
@@ -78,6 +78,7 @@ class Permissions extends BitField {
|
||||
* * `MANAGE_ROLES`
|
||||
* * `MANAGE_WEBHOOKS`
|
||||
* * `MANAGE_EMOJIS`
|
||||
* * `REQUEST_TO_SPEAK`
|
||||
* @type {Object<string, bigint>}
|
||||
* @see {@link https://discord.com/developers/docs/topics/permissions}
|
||||
*/
|
||||
@@ -113,6 +114,7 @@ Permissions.FLAGS = {
|
||||
MANAGE_ROLES: 1n << 28n,
|
||||
MANAGE_WEBHOOKS: 1n << 29n,
|
||||
MANAGE_EMOJIS: 1n << 30n,
|
||||
REQUEST_TO_SPEAK: 1n << 32n,
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -127,6 +129,13 @@ Permissions.ALL = Object.values(Permissions.FLAGS).reduce((all, p) => all | p, 0
|
||||
*/
|
||||
Permissions.DEFAULT = BigInt(104324673);
|
||||
|
||||
/**
|
||||
* Bitfield representing the permissions required for moderators of stage channels
|
||||
* @type {bigint}
|
||||
*/
|
||||
Permissions.STAGE_MODERATOR =
|
||||
Permissions.FLAGS.MANAGE_CHANNELS | Permissions.FLAGS.MUTE_MEMBERS | Permissions.FLAGS.MOVE_MEMBERS;
|
||||
|
||||
Permissions.defaultBit = BigInt(0);
|
||||
|
||||
module.exports = Permissions;
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
* * **`CategoryChannel`**
|
||||
* * **`NewsChannel`**
|
||||
* * **`StoreChannel`**
|
||||
* * **`StageChannel`**
|
||||
* * **`GuildMember`**
|
||||
* * **`Guild`**
|
||||
* * **`Message`**
|
||||
@@ -98,6 +99,7 @@ const structures = {
|
||||
CategoryChannel: require('../structures/CategoryChannel'),
|
||||
NewsChannel: require('../structures/NewsChannel'),
|
||||
StoreChannel: require('../structures/StoreChannel'),
|
||||
StageChannel: require('../structures/StageChannel'),
|
||||
GuildMember: require('../structures/GuildMember'),
|
||||
Guild: require('../structures/Guild'),
|
||||
Message: require('../structures/Message'),
|
||||
|
||||
Reference in New Issue
Block a user