3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-18 23:09:59 +00:00
zeppelin/backend/src/utils/canReadChannel.ts

11 lines
397 B
TypeScript
Raw Normal View History

import { Constants, GuildChannel } from "eris";
import { hasChannelPermissions } from "./hasChannelPermissions";
export function canReadChannel(channel: GuildChannel, memberId: string) {
const channelPermissions = channel.permissionsOf(memberId);
return hasChannelPermissions(channelPermissions, [
Constants.Permissions.readMessages,
Constants.Permissions.readMessageHistory,
]);
}