mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 12:25:02 +00:00
Port CompanionChannels
This commit is contained in:
parent
95a03a0110
commit
0f69473c05
8 changed files with 160 additions and 0 deletions
|
@ -0,0 +1,17 @@
|
|||
import { PluginData } from "knub";
|
||||
import { CompanionChannelsPluginType, TCompanionChannelOpts } from "../types";
|
||||
|
||||
const defaultCompanionChannelOpts: Partial<TCompanionChannelOpts> = {
|
||||
enabled: true,
|
||||
};
|
||||
|
||||
export function getCompanionChannelOptsForVoiceChannelId(
|
||||
pluginData: PluginData<CompanionChannelsPluginType>,
|
||||
userId: string,
|
||||
voiceChannelId: string,
|
||||
): TCompanionChannelOpts[] {
|
||||
const config = pluginData.config.getMatchingConfig({ userId, channelId: voiceChannelId });
|
||||
return Object.values(config.entries)
|
||||
.filter(opts => opts.voice_channel_ids.includes(voiceChannelId))
|
||||
.map(opts => Object.assign({}, defaultCompanionChannelOpts, opts));
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue