upgrade discord.js
This commit is contained in:
parent
036d46f08a
commit
3537305c59
32 changed files with 232 additions and 107 deletions
|
@ -118,7 +118,7 @@ export const CleanCmd = utilityCmd({
|
|||
const deletePins = args["delete-pins"] != null ? args["delete-pins"] : false;
|
||||
let pins: Message[] = [];
|
||||
if (!deletePins) {
|
||||
pins = (await msg.channel.messages.fetchPinned()).array();
|
||||
pins = [...(await msg.channel.messages.fetchPinned().catch(() => [])).values()];
|
||||
}
|
||||
|
||||
while (messagesToClean.length < args.count) {
|
||||
|
@ -128,14 +128,14 @@ export const CleanCmd = utilityCmd({
|
|||
});
|
||||
if (potentialMessages.size === 0) break;
|
||||
|
||||
const existingStored = await pluginData.state.savedMessages.getMultiple(potentialMessages.keyArray());
|
||||
const existingStored = await pluginData.state.savedMessages.getMultiple([...potentialMessages.keys()]);
|
||||
const alreadyStored = existingStored.map(stored => stored.id);
|
||||
const messagesToStore = potentialMessages
|
||||
.array()
|
||||
.filter(potentialMsg => !alreadyStored.includes(potentialMsg.id));
|
||||
const messagesToStore = [
|
||||
...potentialMessages.filter(potentialMsg => !alreadyStored.includes(potentialMsg.id)).values(),
|
||||
];
|
||||
await pluginData.state.savedMessages.createFromMessages(messagesToStore);
|
||||
|
||||
const potentialMessagesToClean = await pluginData.state.savedMessages.getMultiple(potentialMessages.keyArray());
|
||||
const potentialMessagesToClean = await pluginData.state.savedMessages.getMultiple([...potentialMessages.keys()]);
|
||||
if (potentialMessagesToClean.length === 0) break;
|
||||
|
||||
const filtered: SavedMessage[] = [];
|
||||
|
|
|
@ -32,7 +32,7 @@ export const VcdisconnectCmd = utilityCmd({
|
|||
const channel = pluginData.guild.channels.cache.get(args.member.voice.channelId) as VoiceChannel;
|
||||
|
||||
try {
|
||||
await args.member.voice.kick();
|
||||
await args.member.voice.disconnect();
|
||||
} catch {
|
||||
sendErrorMessage(pluginData, msg.channel, "Failed to disconnect member");
|
||||
return;
|
||||
|
|
|
@ -9,6 +9,7 @@ import { LogType } from "../../../data/LogType";
|
|||
import { canActOn, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { channelMentionRegex, isSnowflake, simpleClosestStringMatch } from "../../../utils";
|
||||
import { utilityCmd } from "../types";
|
||||
import { ChannelTypeStrings } from "../../../types";
|
||||
|
||||
export const VcmoveCmd = utilityCmd({
|
||||
trigger: "vcmove",
|
||||
|
@ -45,9 +46,11 @@ export const VcmoveCmd = utilityCmd({
|
|||
channel = potentialChannel;
|
||||
} else {
|
||||
// Search string -> find closest matching voice channel name
|
||||
const voiceChannels = pluginData.guild.channels.cache.array().filter(theChannel => {
|
||||
return theChannel instanceof VoiceChannel;
|
||||
}) as VoiceChannel[];
|
||||
const voiceChannels = [
|
||||
...pluginData.guild.channels.cache
|
||||
.filter((c): c is VoiceChannel => c.type === ChannelTypeStrings.VOICE)
|
||||
.values(),
|
||||
];
|
||||
const closestMatch = simpleClosestStringMatch(args.channel, voiceChannels, ch => ch.name);
|
||||
if (!closestMatch) {
|
||||
sendErrorMessage(pluginData, msg.channel, "No matching voice channels");
|
||||
|
@ -124,9 +127,11 @@ export const VcmoveAllCmd = utilityCmd({
|
|||
channel = potentialChannel;
|
||||
} else {
|
||||
// Search string -> find closest matching voice channel name
|
||||
const voiceChannels = pluginData.guild.channels.cache.array().filter(theChannel => {
|
||||
return theChannel instanceof VoiceChannel;
|
||||
}) as VoiceChannel[];
|
||||
const voiceChannels = [
|
||||
...pluginData.guild.channels.cache
|
||||
.filter((c): c is VoiceChannel => c.type === ChannelTypeStrings.VOICE)
|
||||
.values(),
|
||||
];
|
||||
const closestMatch = simpleClosestStringMatch(args.channel, voiceChannels, ch => ch.name);
|
||||
if (!closestMatch) {
|
||||
sendErrorMessage(pluginData, msg.channel, "No matching voice channels");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue