3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-19 07:20:00 +00:00
zeppelin/backend/src/plugins/Utility/UtilityPlugin.ts

142 lines
3.9 KiB
TypeScript
Raw Normal View History

import { zeppelinPlugin } from "../ZeppelinPluginBlueprint";
import { ConfigSchema, UtilityPluginType } from "./types";
import { GuildLogs } from "../../data/GuildLogs";
import { GuildCases } from "../../data/GuildCases";
import { GuildSavedMessages } from "../../data/GuildSavedMessages";
import { GuildArchives } from "../../data/GuildArchives";
import { Supporters } from "../../data/Supporters";
import { ServerCmd } from "./commands/ServerCmd";
import { RolesCmd } from "./commands/RolesCmd";
import { LevelCmd } from "./commands/LevelCmd";
2020-07-06 00:53:28 +03:00
import { SearchCmd } from "./commands/SearchCmd";
import { BanSearchCmd } from "./commands/BanSearchCmd";
import { InfoCmd } from "./commands/InfoCmd";
import { NicknameResetCmd } from "./commands/NicknameResetCmd";
import { NicknameCmd } from "./commands/NicknameCmd";
import { PingCmd } from "./commands/PingCmd";
import { SourceCmd } from "./commands/SourceCmd";
import { ContextCmd } from "./commands/ContextCmd";
import { VcmoveCmd } from "./commands/VcmoveCmd";
import { HelpCmd } from "./commands/HelpCmd";
import { AboutCmd } from "./commands/AboutCmd";
2020-07-06 02:10:22 +03:00
import { PluginOptions } from "knub";
import { activeReloads } from "./guildReloads";
import { sendSuccessMessage } from "../../pluginUtils";
import { ReloadGuildCmd } from "./commands/ReloadGuildCmd";
import { JumboCmd } from "./commands/JumboCmd";
import { AvatarCmd } from "./commands/AvatarCmd";
2020-07-06 02:56:54 +03:00
import { CleanCmd } from "./commands/CleanCmd";
import { Message } from "eris";
2020-08-05 18:52:15 +03:00
import { InviteInfoCmd } from "./commands/InviteInfoCmd";
2020-08-05 22:54:14 +03:00
import { ChannelInfoCmd } from "./commands/ChannelInfoCmd";
2020-08-06 00:46:47 +03:00
import { MessageInfoCmd } from "./commands/MessageInfoCmd";
2020-07-06 02:10:22 +03:00
const defaultOptions: PluginOptions<UtilityPluginType> = {
config: {
can_roles: false,
can_level: false,
can_search: false,
can_clean: false,
can_info: false,
can_server: false,
2020-08-05 18:52:15 +03:00
can_invite: false,
2020-08-05 22:54:14 +03:00
can_channel: false,
2020-08-06 00:46:47 +03:00
can_message: false,
2020-07-06 02:10:22 +03:00
can_reload_guild: false,
can_nickname: false,
can_ping: false,
can_source: false,
can_vcmove: false,
can_help: false,
can_about: false,
can_context: false,
can_jumbo: false,
jumbo_size: 128,
can_avatar: false,
info_on_single_result: true,
2020-07-06 02:10:22 +03:00
},
overrides: [
{
level: ">=50",
config: {
can_roles: true,
can_level: true,
can_search: true,
can_clean: true,
can_info: true,
can_server: true,
2020-08-05 18:52:15 +03:00
can_invite: true,
2020-08-05 22:54:14 +03:00
can_channel: true,
2020-08-06 00:46:47 +03:00
can_message: true,
2020-07-06 02:10:22 +03:00
can_nickname: true,
can_vcmove: true,
can_help: true,
can_context: true,
can_jumbo: true,
can_avatar: true,
can_source: true,
2020-07-06 02:10:22 +03:00
},
},
{
level: ">=100",
config: {
can_reload_guild: true,
can_ping: true,
can_about: true,
},
},
],
};
export const UtilityPlugin = zeppelinPlugin<UtilityPluginType>()("utility", {
2020-07-30 13:08:06 +03:00
showInDocs: true,
info: {
prettyName: "Utility",
},
configSchema: ConfigSchema,
2020-07-06 02:10:22 +03:00
defaultOptions,
// prettier-ignore
commands: [
SearchCmd,
BanSearchCmd,
InfoCmd,
LevelCmd,
RolesCmd,
ServerCmd,
NicknameResetCmd,
NicknameCmd,
PingCmd,
SourceCmd,
ContextCmd,
VcmoveCmd,
HelpCmd,
AboutCmd,
ReloadGuildCmd,
JumboCmd,
AvatarCmd,
2020-07-06 02:56:54 +03:00
CleanCmd,
2020-08-05 18:52:15 +03:00
InviteInfoCmd,
2020-08-05 22:54:14 +03:00
ChannelInfoCmd,
2020-08-06 00:46:47 +03:00
MessageInfoCmd,
],
onLoad(pluginData) {
const { state, guild } = pluginData;
state.logs = new GuildLogs(guild.id);
state.cases = GuildCases.getGuildInstance(guild.id);
state.savedMessages = GuildSavedMessages.getGuildInstance(guild.id);
state.archives = GuildArchives.getGuildInstance(guild.id);
state.supporters = new Supporters();
state.lastReload = Date.now();
if (activeReloads.has(guild.id)) {
sendSuccessMessage(pluginData, activeReloads.get(guild.id), "Reloaded!");
activeReloads.delete(guild.id);
}
2020-07-06 00:53:28 +03:00
},
});