Finish preliminary rework, ready to test

This commit is contained in:
Dark 2021-06-02 04:07:50 +02:00
parent 57893e7f76
commit d0a1beb809
No known key found for this signature in database
GPG key ID: 2CD6ACB6B0A87B8A
177 changed files with 854 additions and 707 deletions

View file

@ -1,6 +1,7 @@
import { botControlCmd } from "../types";
import { isOwnerPreFilter, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { TextChannel } from "discord.js";
export const ReloadServerCmd = botControlCmd({
trigger: ["reload_server", "reload_guild"],
@ -14,19 +15,19 @@ export const ReloadServerCmd = botControlCmd({
},
async run({ pluginData, message: msg, args }) {
if (!pluginData.client.guilds.has(args.guildId)) {
sendErrorMessage(pluginData, msg.channel, "I am not in that guild");
if (!pluginData.client.guilds.cache.has(args.guildId)) {
sendErrorMessage(pluginData, msg.channel as TextChannel, "I am not in that guild");
return;
}
try {
await pluginData.getKnubInstance().reloadGuild(args.guildId);
} catch (e) {
sendErrorMessage(pluginData, msg.channel, `Failed to reload guild: ${e.message}`);
sendErrorMessage(pluginData, msg.channel as TextChannel, `Failed to reload guild: ${e.message}`);
return;
}
const guild = pluginData.client.guilds.get(args.guildId);
sendSuccessMessage(pluginData, msg.channel, `Reloaded guild **${guild?.name || "???"}**`);
const guild = await pluginData.client.guilds.fetch(args.guildId);
sendSuccessMessage(pluginData, msg.channel as TextChannel, `Reloaded guild **${guild?.name || "???"}**`);
},
});