diff --git a/src/routes/channels/#channel_id/messages/index.ts b/src/routes/channels/#channel_id/messages/index.ts
index b42a886b..5f1f6c54 100644
--- a/src/routes/channels/#channel_id/messages/index.ts
+++ b/src/routes/channels/#channel_id/messages/index.ts
@@ -99,13 +99,16 @@ const messageUpload = multer({
// https://discord.com/developers/docs/resources/channel#create-message
// TODO: text channel slowdown
// TODO: trim and replace message content and every embed field
+// TODO: check allowed_mentions
// Send message
-router.post("/", check(MessageCreateSchema), messageUpload.single("file"), async (req: Request, res: Response) => {
+router.post("/", messageUpload.single("file"), async (req: Request, res: Response) => {
const { channel_id } = req.params;
var body = req.body as MessageCreateSchema;
const attachments: Attachment[] = [];
+ console.log(body);
+
if (req.file) {
try {
const file = await uploadFile(`/attachments/${channel_id}`, req.file);
@@ -117,10 +120,11 @@ router.post("/", check(MessageCreateSchema), messageUpload.single("file"), async
if (body.payload_json) {
body = JSON.parse(body.payload_json);
- const errors = instanceOf(MessageCreateSchema, body, { req });
- if (errors !== true) throw errors;
}
+ const errors = instanceOf(MessageCreateSchema, body, { req });
+ if (errors !== true) throw errors;
+
const embeds = [];
if (body.embed) embeds.push(body.embed);
const data = await sendMessage({ ...body, type: 0, pinned: false, author_id: req.user_id, embeds, channel_id, attachments });
|