mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 12:25:02 +00:00
fix more MessageEmbed / MessageOptions
Signed-off-by: GitHub <noreply@github.com>
This commit is contained in:
parent
b527295f5a
commit
1a8027de16
2 changed files with 8 additions and 8 deletions
|
@ -1,4 +1,4 @@
|
||||||
import { GuildTextBasedChannel, MessageOptions, WebhookClient } from "discord.js";
|
import { GuildTextBasedChannel, MessageCreateOptions, WebhookClient } from "discord.js";
|
||||||
import { GuildPluginData } from "knub";
|
import { GuildPluginData } from "knub";
|
||||||
import { InternalPosterPluginType } from "../types";
|
import { InternalPosterPluginType } from "../types";
|
||||||
import { channelIsWebhookable } from "./getOrCreateWebhookForChannel";
|
import { channelIsWebhookable } from "./getOrCreateWebhookForChannel";
|
||||||
|
@ -12,7 +12,7 @@ export type InternalPosterMessageResult = {
|
||||||
|
|
||||||
async function sendDirectly(
|
async function sendDirectly(
|
||||||
channel: GuildTextBasedChannel,
|
channel: GuildTextBasedChannel,
|
||||||
content: MessageOptions,
|
content: MessageCreateOptions,
|
||||||
): Promise<InternalPosterMessageResult | null> {
|
): Promise<InternalPosterMessageResult | null> {
|
||||||
return channel.send(content).then((message) => ({
|
return channel.send(content).then((message) => ({
|
||||||
id: message.id,
|
id: message.id,
|
||||||
|
@ -26,7 +26,7 @@ async function sendDirectly(
|
||||||
export async function sendMessage(
|
export async function sendMessage(
|
||||||
pluginData: GuildPluginData<InternalPosterPluginType>,
|
pluginData: GuildPluginData<InternalPosterPluginType>,
|
||||||
channel: GuildTextBasedChannel,
|
channel: GuildTextBasedChannel,
|
||||||
content: MessageOptions,
|
content: MessageCreateOptions,
|
||||||
): Promise<InternalPosterMessageResult | null> {
|
): Promise<InternalPosterMessageResult | null> {
|
||||||
return pluginData.state.queue.add(async () => {
|
return pluginData.state.queue.add(async () => {
|
||||||
let webhookClient: WebhookClient | null = null;
|
let webhookClient: WebhookClient | null = null;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { GuildTextBasedChannel, MessageEmbed, Snowflake } from "discord.js";
|
import { EmbedData, GuildTextBasedChannel, Snowflake } from "discord.js";
|
||||||
import { GuildPluginData } from "knub";
|
import { GuildPluginData } from "knub";
|
||||||
import cloneDeep from "lodash.clonedeep";
|
import cloneDeep from "lodash.clonedeep";
|
||||||
import { SavedMessage } from "../../../data/entities/SavedMessage";
|
import { SavedMessage } from "../../../data/entities/SavedMessage";
|
||||||
|
@ -14,13 +14,13 @@ export async function onMessageUpdate(
|
||||||
// To log a message update, either the message content or a rich embed has to change
|
// To log a message update, either the message content or a rich embed has to change
|
||||||
let logUpdate = false;
|
let logUpdate = false;
|
||||||
|
|
||||||
const oldEmbedsToCompare = ((oldSavedMessage.data.embeds || []) as MessageEmbed[])
|
const oldEmbedsToCompare = ((oldSavedMessage.data.embeds || []) as EmbedData[])
|
||||||
.map((e) => cloneDeep(e))
|
.map((e) => cloneDeep(e))
|
||||||
.filter((e) => (e as MessageEmbed).type === "rich");
|
.filter((e) => (e as EmbedData).type === "rich");
|
||||||
|
|
||||||
const newEmbedsToCompare = ((savedMessage.data.embeds || []) as MessageEmbed[])
|
const newEmbedsToCompare = ((savedMessage.data.embeds || []) as EmbedData[])
|
||||||
.map((e) => cloneDeep(e))
|
.map((e) => cloneDeep(e))
|
||||||
.filter((e) => (e as MessageEmbed).type === "rich");
|
.filter((e) => (e as EmbedData).type === "rich");
|
||||||
|
|
||||||
for (const embed of [...oldEmbedsToCompare, ...newEmbedsToCompare]) {
|
for (const embed of [...oldEmbedsToCompare, ...newEmbedsToCompare]) {
|
||||||
if (embed.thumbnail) {
|
if (embed.thumbnail) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue