3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-10 12:25:02 +00:00

Type fixes for djs

This commit is contained in:
Dark 2021-06-30 04:56:56 +02:00
parent 653d6c1dc2
commit 0822fc15e5
No known key found for this signature in database
GPG key ID: 2CD6ACB6B0A87B8A
130 changed files with 8877 additions and 411 deletions

View file

@ -1,4 +1,4 @@
import { FileOptions, Message, MessageOptions, TextChannel } from "discord.js";
import { FileOptions, Message, MessageOptions, Snowflake, TextChannel } from "discord.js";
import { GuildPluginData } from "knub";
import { Case } from "../../../data/entities/Case";
import { LogType } from "../../../data/LogType";
@ -15,7 +15,7 @@ export async function postToCaseLogChannel(
const caseLogChannelId = pluginData.config.get().case_log_channel;
if (!caseLogChannelId) return null;
const caseLogChannel = pluginData.guild.channels.cache.get(caseLogChannelId);
const caseLogChannel = pluginData.guild.channels.cache.get(caseLogChannelId as Snowflake);
if (!caseLogChannel || !(caseLogChannel instanceof TextChannel)) return null;
let result;
@ -23,7 +23,7 @@ export async function postToCaseLogChannel(
if (file != null) {
content.files = file;
}
result = await caseLogChannel.send({ ...content, split: false });
result = await caseLogChannel.send({ ...content });
} catch (e) {
if (isDiscordRESTError(e) && (e.code === 50013 || e.code === 50001)) {
pluginData.state.logs.log(LogType.BOT_ALERT, {
@ -52,8 +52,8 @@ export async function postCaseToCaseLogChannel(
const [channelId, messageId] = theCase.log_message_id.split("-");
try {
const channel = pluginData.guild.channels.resolve(channelId) as TextChannel;
await channel.messages.edit(messageId, caseEmbed);
const channel = pluginData.guild.channels.resolve(channelId as Snowflake) as TextChannel;
await channel.messages.edit(messageId as Snowflake, caseEmbed);
return null;
} catch {} // tslint:disable-line:no-empty
}