summary refs log tree commit diff
path: root/src/routes/channels
diff options
context:
space:
mode:
authorDiego Magdaleno <diegomagdaleno@protonmail.com>2021-05-21 18:18:58 -0500
committerDiego Magdaleno <diegomagdaleno@protonmail.com>2021-05-21 18:18:58 -0500
commit05057b922a84c6b0331357867dfa50166320b318 (patch)
tree55b1ccb6e0ce0347a3f9e93932fa4acd81b5bf24 /src/routes/channels
parentMeta: Clean up the format file (diff)
downloadserver-05057b922a84c6b0331357867dfa50166320b318.tar.xz
Config: Refactor config method, so we have a new get all option, fix issues in configurations
Diffstat (limited to 'src/routes/channels')
-rw-r--r--src/routes/channels/#channel_id/messages/bulk-delete.ts3
-rw-r--r--src/routes/channels/#channel_id/pins.ts3
2 files changed, 2 insertions, 4 deletions
diff --git a/src/routes/channels/#channel_id/messages/bulk-delete.ts b/src/routes/channels/#channel_id/messages/bulk-delete.ts

index c469e495..c70e7ac1 100644 --- a/src/routes/channels/#channel_id/messages/bulk-delete.ts +++ b/src/routes/channels/#channel_id/messages/bulk-delete.ts
@@ -20,8 +20,7 @@ router.post("/", check({ messages: [String] }), async (req, res) => { const permission = await getPermission(req.user_id, channel?.guild_id, channel_id, { channel }); permission.hasThrow("MANAGE_MESSAGES"); - const limitsProperties = Config.apiConfig.get('limits.message') as Config.DefaultOptions; - const { maxBulkDelete } = limitsProperties.limits.message; + const { maxBulkDelete } = Config.apiConfig.getAll().limits.message; const { messages } = req.body as { messages: string[] }; if (messages.length < 2) throw new HTTPError("You must at least specify 2 messages to bulk delete"); diff --git a/src/routes/channels/#channel_id/pins.ts b/src/routes/channels/#channel_id/pins.ts
index d8e2be9b..4d8f53b1 100644 --- a/src/routes/channels/#channel_id/pins.ts +++ b/src/routes/channels/#channel_id/pins.ts
@@ -18,8 +18,7 @@ router.put("/:message_id", async (req: Request, res: Response) => { if (channel.guild_id) permission.hasThrow("MANAGE_MESSAGES"); const pinned_count = await MessageModel.count({ channel_id, pinned: true }).exec(); - const limitsProperties = Config.apiConfig.get('limits.channel') as Config.DefaultOptions; - const { maxPins } = limitsProperties.limits.channel; + const { maxPins } = Config.apiConfig.getAll().limits.channel; if (pinned_count >= maxPins) throw new HTTPError("Max pin count reached: " + maxPins); await MessageModel.updateOne({ id: message_id }, { pinned: true }).exec();