feat(StageChannel): add createStageInstance method & use better naming convention (#5951)

Co-authored-by: SpaceEEC <spaceeec@yahoo.com>
This commit is contained in:
Shubham Parihar
2021-07-01 14:28:11 +05:30
committed by GitHub
parent 388e05b4af
commit 71fb33a5fe
4 changed files with 26 additions and 18 deletions

View File

@@ -20,14 +20,23 @@ class StageChannel extends BaseGuildVoiceChannel {
}
/**
* The instance of this stage channel, if it exists
* The stage instance of this stage channel, if it exists
* @type {?StageInstance}
* @readonly
*/
get instance() {
get stageInstance() {
return this.guild.stageInstances.cache.find(stageInstance => stageInstance.channelID === this.id) ?? null;
}
/**
* Creates a stage instance associated to this stage channel.
* @param {StageInstanceCreateOptions} options The options to create the stage instance
* @returns {Promise<StageInstance>}
*/
createStageInstance(options) {
return this.guild.stageInstances.create(this.id, options);
}
/**
* Sets the RTC region of the channel.
* @name StageChannel#setRTCRegion

View File

@@ -60,7 +60,7 @@ class StageInstance extends Base {
}
/**
* The stage channel associated with this instance
* The stage channel associated with this stage instance
* @type {?StageChannel}
* @readonly
*/