mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-06 14:20:51 +02:00
userPermissions and clientPermissions are in commando now
This commit is contained in:
+2
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiaobot",
|
||||
"version": "35.1.6",
|
||||
"version": "35.1.7",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Shard.js",
|
||||
"scripts": {
|
||||
@@ -35,7 +35,7 @@
|
||||
"common-tags": "^1.4.0",
|
||||
"custom-translate": "github:dragonfire535/custom-translate",
|
||||
"discord.js": "github:hydrabolt/discord.js",
|
||||
"discord.js-commando": "github:dragonfire535/discord.js-commando#test",
|
||||
"discord.js-commando": "github:gawdl3y/discord.js-commando",
|
||||
"erlpack": "github:hammerandchisel/erlpack",
|
||||
"node-opus": "^0.2.6",
|
||||
"snekfetch": "^3.3.0",
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const perms = require('../assets/json/permissions');
|
||||
|
||||
class XiaoCommand extends Command {
|
||||
constructor(client, info) {
|
||||
super(client, info);
|
||||
|
||||
this.ownerOnly = info.ownerOnly;
|
||||
this.clientPermissions = info.clientPermissions;
|
||||
this.userPermissions = info.userPermissions;
|
||||
this.throttling = info.throttling || {
|
||||
usages: 1,
|
||||
duration: 2
|
||||
@@ -18,22 +15,6 @@ class XiaoCommand extends Command {
|
||||
if (this.ownerOnly && !this.client.isOwner(msg.author)) {
|
||||
return `The \`${this.name}\` command can only be used by the bot owner.`;
|
||||
}
|
||||
if (msg.channel.type === 'text') {
|
||||
if (this.clientPermissions) {
|
||||
for (const permission of this.clientPermissions) {
|
||||
if (!msg.channel.permissionsFor(this.client.user).has(permission)) {
|
||||
return `The \`${this.name}\` command requires me to have the \`${perms[permission]}\` permission.`;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.userPermissions) {
|
||||
for (const permission of this.userPermissions) {
|
||||
if (!msg.channel.permissionsFor(msg.author).has(permission)) {
|
||||
return `The \`${this.name}\` command requires you to have the \`${perms[permission]}\` permission.`;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user