27 lines
922 B
TypeScript
27 lines
922 B
TypeScript
import { isStaffPreFilter, sendErrorMessage } from "../../../pluginUtils";
|
|
import { getActiveReload, setActiveReload } from "../activeReload";
|
|
import { botControlCmd } from "../types";
|
|
import { TextBasedChannelFields } from "discord.js";
|
|
|
|
export const ReloadGlobalPluginsCmd = botControlCmd({
|
|
trigger: "bot_reload_global_plugins",
|
|
permission: null,
|
|
config: {
|
|
preFilters: [isStaffPreFilter],
|
|
},
|
|
|
|
async run({ pluginData, message }) {
|
|
if (getActiveReload()) return;
|
|
|
|
const guildId = "guild" in message.channel ? message.channel.guild.id : null;
|
|
if (!guildId) {
|
|
await sendErrorMessage(pluginData, message.channel, "This command can only be used in a server");
|
|
return;
|
|
}
|
|
|
|
setActiveReload(guildId, message.channel.id);
|
|
await (message.channel as TextBasedChannelFields).send("Reloading global plugins...");
|
|
|
|
await pluginData.getKnubInstance().reloadGlobalContext();
|
|
},
|
|
});
|