mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-16 08:22:22 +02:00
Clean-ups
This commit is contained in:
@@ -16,24 +16,20 @@ class XiaoCommand extends Command {
|
||||
}
|
||||
|
||||
hasPermission(msg) {
|
||||
if (this.ownerOnly && !this.client.isOwner(msg.author)) {
|
||||
return 'This Command can only be used by the bot owner.';
|
||||
}
|
||||
if (this.nsfw && !msg.channel.nsfw) {
|
||||
return 'This Command can only be used in NSFW Channels.';
|
||||
}
|
||||
if (msg.channel.type !== 'dm') {
|
||||
if (this.ownerOnly && !this.client.isOwner(msg.author)) return 'This Command can only be used by the bot owner.';
|
||||
if (this.nsfw && !msg.channel.nsfw) return 'This Command can only be used in NSFW Channels.';
|
||||
if (msg.channel.type === 'text') {
|
||||
if (this.clientPermissions) {
|
||||
for (const permission of this.clientPermissions) {
|
||||
if (!msg.channel.permissionsFor(this.client.user).has(permission)) {
|
||||
return `This Command requires the \`${perms[permission]}\` Permission.`;
|
||||
return `This 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 `You do not have the \`${perms[permission]}\` Permission.`;
|
||||
return `This Command requires you to have the \`${perms[permission]}\` Permission.`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+13
-13
@@ -5,11 +5,11 @@ const { CARBON_KEY, DBOTS_KEY, DBOTSORG_KEY } = process.env;
|
||||
class Util {
|
||||
static cleanXML(str) {
|
||||
return str
|
||||
.replace(/(<br \/>)/g, '')
|
||||
.replace(/(')/g, '\'')
|
||||
.replace(/(—)/g, '—')
|
||||
.replace(/<br \/>/g, '')
|
||||
.replace(/'/g, '\'')
|
||||
.replace(/—/g, '—')
|
||||
.replace(/("|")/g, '"')
|
||||
.replace(/(&)/g, '&')
|
||||
.replace(/&/g, '&')
|
||||
.replace(/(\[i\]|\[\/i\])/g, '*');
|
||||
}
|
||||
|
||||
@@ -44,8 +44,8 @@ class Util {
|
||||
|
||||
static filterTopics(channels, setting) {
|
||||
return channels.filter(c => {
|
||||
if (c.type !== 'text' || !c.topic) return false;
|
||||
if (c.topic.includes(`<${setting}>`) && c.permissionsFor(c.client.user).has('SEND_MESSAGES')) return true;
|
||||
if (c.type !== 'text' || !c.topic || !c.permissionsFor(c.client.user).has('SEND_MESSAGES')) return false;
|
||||
if (c.topic.includes(`<${setting}>`)) return true;
|
||||
return false;
|
||||
});
|
||||
}
|
||||
@@ -63,13 +63,13 @@ class Util {
|
||||
}
|
||||
|
||||
static shuffle(arr) {
|
||||
for (let i = arr.length - 1; i > 0; i--) {
|
||||
const j = Math.floor(Math.random() * (i + 1));
|
||||
const temp = arr[i];
|
||||
arr[i] = arr[j];
|
||||
arr[j] = temp;
|
||||
}
|
||||
return arr;
|
||||
for (let i = arr.length - 1; i > 0; i--) {
|
||||
const j = Math.floor(Math.random() * (i + 1));
|
||||
const temp = arr[i];
|
||||
arr[i] = arr[j];
|
||||
arr[j] = temp;
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user