3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-10 12:25:02 +00:00

Improve permission utils, make them bigint-aware

This commit is contained in:
Dragory 2020-08-07 00:39:52 +03:00
parent a404c7a97f
commit 8af64a6944
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
11 changed files with 97 additions and 34 deletions

View file

@ -30,7 +30,7 @@ export const ContextCmd = utilityCmd({
const channel = args.channel || args.message.channel;
const messageId = args.messageId || args.message.messageId;
if (!canReadChannel(channel, msg.member.id)) {
if (!canReadChannel(channel, msg.member)) {
sendErrorMessage(pluginData, msg.channel, "Message context not found");
return;
}

View file

@ -61,7 +61,7 @@ export const InfoCmd = utilityCmd({
// 4. Message
const messageTarget = await resolveMessageTarget(pluginData, value);
if (messageTarget) {
if (canReadChannel(messageTarget.channel, message.author.id)) {
if (canReadChannel(messageTarget.channel, message.member)) {
const embed = await getMessageInfoEmbed(pluginData, messageTarget.channel.id, messageTarget.messageId);
if (embed) {
message.channel.createMessage({ embed });

View file

@ -15,7 +15,7 @@ export const MessageInfoCmd = utilityCmd({
},
async run({ message, args, pluginData }) {
if (!canReadChannel(args.message.channel, message.author.id)) {
if (!canReadChannel(args.message.channel, message.member)) {
sendErrorMessage(pluginData, message.channel, "Unknown message");
return;
}

View file

@ -4,7 +4,6 @@ import { errorMessage } from "../../../utils";
import { getBaseUrl, sendErrorMessage } from "../../../pluginUtils";
import moment from "moment-timezone";
import { Constants, TextChannel } from "eris";
import { hasChannelPermissions } from "../../../utils/hasChannelPermissions";
import { canReadChannel } from "../../../utils/canReadChannel";
export const SourceCmd = utilityCmd({
@ -18,7 +17,7 @@ export const SourceCmd = utilityCmd({
},
async run({ message: cmdMessage, args, pluginData }) {
if (!canReadChannel(args.message.channel, cmdMessage.member.id)) {
if (!canReadChannel(args.message.channel, cmdMessage.member)) {
sendErrorMessage(pluginData, cmdMessage.channel, "Unknown message");
return;
}