3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-11 04:45: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 { TextChannel } from "discord.js";
import { Snowflake, TextChannel } from "discord.js";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { postCmd } from "../types";
@ -25,9 +25,12 @@ export const EditCmd = postCmd({
return;
}
(pluginData.guild.channels.cache.get(savedMessage.channel_id) as TextChannel).messages.edit(savedMessage.id, {
content: formatContent(args.content),
});
(pluginData.guild.channels.cache.get(savedMessage.channel_id as Snowflake) as TextChannel).messages.edit(
savedMessage.id as Snowflake,
{
content: formatContent(args.content),
},
);
sendSuccessMessage(pluginData, msg.channel, "Message edited");
},
});

View file

@ -1,4 +1,4 @@
import { MessageEmbed, TextChannel } from "discord.js";
import { MessageEmbed, Snowflake, TextChannel } from "discord.js";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { trimLines } from "../../../utils";
@ -47,9 +47,12 @@ export const EditEmbedCmd = postCmd({
if (content) embed.description = formatContent(content);
if (color) embed.color = color;
(pluginData.guild.channels.cache.get(savedMessage.channel_id) as TextChannel).messages.edit(savedMessage.id, {
embed,
});
(pluginData.guild.channels.cache.get(savedMessage.channel_id as Snowflake) as TextChannel).messages.edit(
savedMessage.id as Snowflake,
{
embeds: [embed],
},
);
await sendSuccessMessage(pluginData, msg.channel, "Embed edited");
if (args.content) {

View file

@ -38,7 +38,7 @@ export async function postMessage(
};
}
const createdMsg = await channel.send(content, file);
const createdMsg = await channel.send({ ...content, files: [file] });
pluginData.state.savedMessages.setPermanent(createdMsg.id);
if (downloadedAttachment) {

View file

@ -1,4 +1,4 @@
import { TextChannel, User } from "discord.js";
import { Snowflake, TextChannel, User } from "discord.js";
import { GuildPluginData } from "knub";
import moment from "moment-timezone";
import { LogType } from "../../../data/LogType";
@ -12,10 +12,10 @@ const SCHEDULED_POST_CHECK_INTERVAL = 5 * SECONDS;
export async function scheduledPostLoop(pluginData: GuildPluginData<PostPluginType>) {
const duePosts = await pluginData.state.scheduledPosts.getDueScheduledPosts();
for (const post of duePosts) {
const channel = pluginData.guild.channels.cache.get(post.channel_id);
const channel = pluginData.guild.channels.cache.get(post.channel_id as Snowflake);
if (channel instanceof TextChannel) {
const [username, discriminator] = post.author_name.split("#");
const author: User = (await pluginData.client.users.fetch(post.author_id)) || {
const author: User = (await pluginData.client.users.fetch(post.author_id as Snowflake)) || {
id: post.author_id,
username,
discriminator,