3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-14 22:05:01 +00:00

auto_reactions: check permissions ahead-of-time

This commit is contained in:
Dragory 2020-08-07 00:09:05 +03:00
parent d276d8e28a
commit a404c7a97f
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
5 changed files with 36 additions and 17 deletions

View file

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