fix: use PermissionStrings

This commit is contained in:
ayntee
2021-03-29 23:31:52 +04:00
parent a98df7f36d
commit 352a7b9f49
+6 -4
View File
@@ -1,6 +1,8 @@
import { cacheHandlers } from "../../cache.ts"; import { cacheHandlers } from "../../cache.ts";
import { RequestManager } from "../../rest/request_manager.ts"; import { RequestManager } from "../../rest/request_manager.ts";
import { structures } from "../../structures/mod.ts"; import { structures } from "../../structures/mod.ts";
import { DiscordChannelTypes } from "../../types/channels/channel_types.ts";
import { PermissionStrings } from "../../types/mod.ts";
import { endpoints } from "../../util/constants.ts"; import { endpoints } from "../../util/constants.ts";
import { requireBotChannelPermissions } from "../../util/permissions.ts"; import { requireBotChannelPermissions } from "../../util/permissions.ts";
@@ -15,15 +17,15 @@ export async function sendMessage(
if (channel) { if (channel) {
if ( if (
![ ![
ChannelTypes.DM, DiscordChannelTypes.DM,
ChannelTypes.GUILD_NEWS, DiscordChannelTypes.GUILD_NEWS,
ChannelTypes.GUILD_TEXT, DiscordChannelTypes.GUILD_TEXT,
].includes(channel.type) ].includes(channel.type)
) { ) {
throw new Error(Errors.CHANNEL_NOT_TEXT_BASED); throw new Error(Errors.CHANNEL_NOT_TEXT_BASED);
} }
const requiredPerms: Set<Permission> = new Set([ const requiredPerms: Set<PermissionStrings> = new Set([
"SEND_MESSAGES", "SEND_MESSAGES",
"VIEW_CHANNEL", "VIEW_CHANNEL",
]); ]);