create custom channel discord implementation
This commit is contained in:
@@ -6,6 +6,7 @@ export interface VoiceChannelsServiceInterface<
|
||||
createVoiceChannel(name: string): Promise<C>;
|
||||
|
||||
cloneVoiceChannel(
|
||||
user_id: string,
|
||||
channel: C,
|
||||
options?: { name?: string; position?: number },
|
||||
): Promise<C>;
|
||||
|
||||
@@ -30,27 +30,29 @@ export class DynamicVoiceChannelsService<
|
||||
);
|
||||
}
|
||||
|
||||
async createDynamicVoiceChannel(id: string): Promise<C | undefined> {
|
||||
if (this.validChannelIds.has(id)) {
|
||||
// Channel is one of the dynamic voice channels, create a new one based on it
|
||||
async createDynamicVoiceChannel(
|
||||
user_id: string,
|
||||
channel_id: string,
|
||||
): Promise<C | undefined> {
|
||||
if (!this.validChannelIds.has(channel_id)) return;
|
||||
// Channel is one of the dynamic voice channels, create a new one based on it
|
||||
|
||||
const channel = await this.voiceChannelsService.getVoiceChannelById(id);
|
||||
const channel =
|
||||
await this.voiceChannelsService.getVoiceChannelById(channel_id);
|
||||
|
||||
if (!channel) return;
|
||||
if (!channel) return;
|
||||
|
||||
const newChannel = await this.voiceChannelsService.cloneVoiceChannel(
|
||||
channel,
|
||||
{
|
||||
name: channel.name,
|
||||
},
|
||||
);
|
||||
const newChannel = await this.voiceChannelsService.cloneVoiceChannel(
|
||||
user_id,
|
||||
channel,
|
||||
{
|
||||
name: channel.name,
|
||||
},
|
||||
);
|
||||
|
||||
this.createdChannelIdsSet.add(newChannel.id);
|
||||
this.createdChannelIdsSet.add(newChannel.id);
|
||||
|
||||
return newChannel;
|
||||
} else {
|
||||
// Channel is not a dynamic voice channel, do nothing
|
||||
}
|
||||
return newChannel;
|
||||
}
|
||||
|
||||
deleteDynamicVoiceChannel(channelId: string): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user