mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 19:28:17 +00:00
fix: check perms only when channel is cached
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import { cacheHandlers } from "../../cache.ts";
|
||||||
import { rest } from "../../rest/rest.ts";
|
import { rest } from "../../rest/rest.ts";
|
||||||
import { structures } from "../../structures/mod.ts";
|
import { structures } from "../../structures/mod.ts";
|
||||||
import { endpoints } from "../../util/constants.ts";
|
import { endpoints } from "../../util/constants.ts";
|
||||||
@@ -5,10 +6,12 @@ import { requireBotChannelPermissions } from "../../util/permissions.ts";
|
|||||||
|
|
||||||
/** Fetch a single message from the server. Requires VIEW_CHANNEL and READ_MESSAGE_HISTORY */
|
/** Fetch a single message from the server. Requires VIEW_CHANNEL and READ_MESSAGE_HISTORY */
|
||||||
export async function getMessage(channelId: string, id: string) {
|
export async function getMessage(channelId: string, id: string) {
|
||||||
|
if (await cacheHandlers.has("channels", channelId)) {
|
||||||
await requireBotChannelPermissions(channelId, [
|
await requireBotChannelPermissions(channelId, [
|
||||||
"VIEW_CHANNEL",
|
"VIEW_CHANNEL",
|
||||||
"READ_MESSAGE_HISTORY",
|
"READ_MESSAGE_HISTORY",
|
||||||
]);
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
const result =
|
const result =
|
||||||
(await rest.runMethod(
|
(await rest.runMethod(
|
||||||
|
|||||||
Reference in New Issue
Block a user