2021-06-06 23:51:32 +02:00
|
|
|
import { CooldownManager } from "knub";
|
2021-07-21 22:14:09 +02:00
|
|
|
import { GuildLogs } from "../../data/GuildLogs";
|
2020-07-30 13:08:06 +03:00
|
|
|
import { trimPluginDescription } from "../../utils";
|
2020-08-01 23:53:47 +03:00
|
|
|
import { LogsPlugin } from "../Logs/LogsPlugin";
|
2021-06-06 23:51:32 +02:00
|
|
|
import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint";
|
2021-06-01 04:33:02 +02:00
|
|
|
import { VoiceStateUpdateEvt } from "./events/VoiceStateUpdateEvt";
|
2021-06-06 23:51:32 +02:00
|
|
|
import { CompanionChannelsPluginType, ConfigSchema } from "./types";
|
2020-07-29 00:28:04 +03:00
|
|
|
|
|
|
|
const defaultOptions = {
|
|
|
|
config: {
|
|
|
|
entries: {},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2021-05-23 14:35:16 +03:00
|
|
|
export const CompanionChannelsPlugin = zeppelinGuildPlugin<CompanionChannelsPluginType>()({
|
|
|
|
name: "companion_channels",
|
2020-07-30 13:08:06 +03:00
|
|
|
showInDocs: true,
|
|
|
|
info: {
|
|
|
|
prettyName: "Companion channels",
|
|
|
|
description: trimPluginDescription(`
|
|
|
|
Set up 'companion channels' between text and voice channels.
|
|
|
|
Once set up, any time a user joins one of the specified voice channels,
|
|
|
|
they'll get channel permissions applied to them for the text channels.
|
|
|
|
`),
|
|
|
|
},
|
|
|
|
|
2020-08-01 23:53:47 +03:00
|
|
|
dependencies: [LogsPlugin],
|
2020-07-29 00:28:04 +03:00
|
|
|
configSchema: ConfigSchema,
|
|
|
|
defaultOptions,
|
|
|
|
|
2021-06-01 04:33:02 +02:00
|
|
|
events: [VoiceStateUpdateEvt],
|
2020-08-01 23:53:47 +03:00
|
|
|
|
2021-05-23 17:13:11 +03:00
|
|
|
beforeLoad(pluginData) {
|
2020-08-01 23:53:47 +03:00
|
|
|
pluginData.state.errorCooldownManager = new CooldownManager();
|
|
|
|
},
|
2021-07-06 05:23:47 +02:00
|
|
|
|
|
|
|
afterLoad(pluginData) {
|
|
|
|
pluginData.state.serverLogs = new GuildLogs(pluginData.guild.id);
|
|
|
|
},
|
2020-07-29 00:28:04 +03:00
|
|
|
});
|