mirror of
https://github.com/spacebarchat/server.git
synced 2024-09-20 01:31:34 +02:00
Prettier & fix merge util/handlers/Message
This commit is contained in:
parent
128b81bc6a
commit
15a2e57b05
@ -43,16 +43,12 @@ import {
|
|||||||
//CHANNEL_MENTION,
|
//CHANNEL_MENTION,
|
||||||
USER_MENTION,
|
USER_MENTION,
|
||||||
Webhook,
|
Webhook,
|
||||||
Attachment,
|
handleFile,
|
||||||
Config,
|
Permissions,
|
||||||
Sticker,
|
|
||||||
MessageCreateSchema,
|
|
||||||
EmbedCache,
|
|
||||||
} from "@spacebar/util";
|
} from "@spacebar/util";
|
||||||
import { HTTPError } from "lambert-server";
|
import { HTTPError } from "lambert-server";
|
||||||
import { In } from "typeorm";
|
import { In } from "typeorm";
|
||||||
import { EmbedHandlers } from "@spacebar/api";
|
import fetch from "node-fetch";
|
||||||
import * as Sentry from "@sentry/node";
|
|
||||||
const allow_empty = false;
|
const allow_empty = false;
|
||||||
// TODO: check webhook, application, system author, stickers
|
// TODO: check webhook, application, system author, stickers
|
||||||
// TODO: embed gifs/videos/images
|
// TODO: embed gifs/videos/images
|
||||||
@ -175,6 +171,11 @@ export async function handleMessage(opts: MessageOptions): Promise<Message> {
|
|||||||
const guild = await Guild.findOneOrFail({
|
const guild = await Guild.findOneOrFail({
|
||||||
where: { id: channel.guild_id },
|
where: { id: channel.guild_id },
|
||||||
});
|
});
|
||||||
|
if (!opts.message_reference.guild_id)
|
||||||
|
opts.message_reference.guild_id = channel.guild_id;
|
||||||
|
if (!opts.message_reference.channel_id)
|
||||||
|
opts.message_reference.channel_id = opts.channel_id;
|
||||||
|
|
||||||
if (!guild.features.includes("CROSS_CHANNEL_REPLIES")) {
|
if (!guild.features.includes("CROSS_CHANNEL_REPLIES")) {
|
||||||
if (opts.message_reference.guild_id !== channel.guild_id)
|
if (opts.message_reference.guild_id !== channel.guild_id)
|
||||||
throw new HTTPError(
|
throw new HTTPError(
|
||||||
@ -185,11 +186,14 @@ export async function handleMessage(opts: MessageOptions): Promise<Message> {
|
|||||||
"You can only reference messages from this channel",
|
"You can only reference messages from this channel",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message.message_reference = opts.message_reference;
|
||||||
}
|
}
|
||||||
/** Q: should be checked if the referenced message exists? ANSWER: NO
|
/** Q: should be checked if the referenced message exists? ANSWER: NO
|
||||||
otherwise backfilling won't work **/
|
otherwise backfilling won't work **/
|
||||||
message.type = MessageType.REPLY;
|
message.type = MessageType.REPLY;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: stickers/activity
|
// TODO: stickers/activity
|
||||||
if (
|
if (
|
||||||
|
Loading…
Reference in New Issue
Block a user