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 });
diff --git a/src/routes/channels/#channel_id/permissions.ts b/src/routes/channels/#channel_id/permissions.ts
index 3993c424..43e61821 100644
--- a/src/routes/channels/#channel_id/permissions.ts
+++ b/src/routes/channels/#channel_id/permissions.ts
@@ -21,7 +21,7 @@ router.put("/:overwrite_id", check({ allow: String, deny: String, type: Number,
if (!(await RoleModel.exists({ id: overwrite_id }))) throw new HTTPError("role not found", 404);
} else if (body.type === 1) {
if (!(await MemberModel.exists({ id: overwrite_id }))) throw new HTTPError("user not found", 404);
- } else throw new HTTPError("type not supported");
+ } else throw new HTTPError("type not supported", 501);
// @ts-ignore
var overwrite: ChannelPermissionOverwrite = channel.permission_overwrites.find((x) => x.id === overwrite_id);
|