mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 12:25:02 +00:00
Upgrade DJS, fix bugs
This commit is contained in:
parent
0822fc15e5
commit
be71357ff9
17 changed files with 123 additions and 66 deletions
|
@ -1,4 +1,4 @@
|
|||
import { TextChannel } from "discord.js";
|
||||
import { Snowflake, TextChannel } from "discord.js";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { isOwnerPreFilter, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { noop } from "../../../utils";
|
||||
|
@ -24,7 +24,7 @@ export const DisallowServerCmd = botControlCmd({
|
|||
|
||||
await pluginData.state.allowedGuilds.remove(args.guildId);
|
||||
await pluginData.client.guilds.cache
|
||||
.get(args.guildId)
|
||||
.get(args.guildId as Snowflake)
|
||||
?.leave()
|
||||
.catch(noop);
|
||||
sendSuccessMessage(pluginData, msg.channel as TextChannel, "Server removed!");
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { TextChannel } from "discord.js";
|
||||
import { Snowflake, TextChannel } from "discord.js";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { isOwnerPreFilter, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { botControlCmd } from "../types";
|
||||
|
@ -15,16 +15,16 @@ export const LeaveServerCmd = botControlCmd({
|
|||
},
|
||||
|
||||
async run({ pluginData, message: msg, args }) {
|
||||
if (!pluginData.client.guilds.cache.has(args.guildId)) {
|
||||
if (!pluginData.client.guilds.cache.has(args.guildId as Snowflake)) {
|
||||
sendErrorMessage(pluginData, msg.channel as TextChannel, "I am not in that guild");
|
||||
return;
|
||||
}
|
||||
|
||||
const guildToLeave = await pluginData.client.guilds.fetch(args.guildId)!;
|
||||
const guildToLeave = await pluginData.client.guilds.fetch(args.guildId as Snowflake)!;
|
||||
const guildName = guildToLeave.name;
|
||||
|
||||
try {
|
||||
await pluginData.client.guilds.cache.get(args.guildId)?.leave();
|
||||
await pluginData.client.guilds.cache.get(args.guildId as Snowflake)?.leave();
|
||||
} catch (e) {
|
||||
sendErrorMessage(pluginData, msg.channel as TextChannel, `Failed to leave guild: ${e.message}`);
|
||||
return;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { TextChannel } from "discord.js";
|
||||
import { Snowflake, TextChannel } from "discord.js";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { isOwnerPreFilter, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { botControlCmd } from "../types";
|
||||
|
@ -15,7 +15,7 @@ export const ReloadServerCmd = botControlCmd({
|
|||
},
|
||||
|
||||
async run({ pluginData, message: msg, args }) {
|
||||
if (!pluginData.client.guilds.cache.has(args.guildId)) {
|
||||
if (!pluginData.client.guilds.cache.has(args.guildId as Snowflake)) {
|
||||
sendErrorMessage(pluginData, msg.channel as TextChannel, "I am not in that guild");
|
||||
return;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ export const ReloadServerCmd = botControlCmd({
|
|||
return;
|
||||
}
|
||||
|
||||
const guild = await pluginData.client.guilds.fetch(args.guildId);
|
||||
const guild = await pluginData.client.guilds.fetch(args.guildId as Snowflake);
|
||||
sendSuccessMessage(pluginData, msg.channel as TextChannel, `Reloaded guild **${guild?.name || "???"}**`);
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue