mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Role Info, Permissions Stuff
This commit is contained in:
@@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"CREATE_INSTANT_INVITE": "Create Instant Invite",
|
||||||
|
"KICK_MEMBERS": "Kick Members",
|
||||||
|
"BAN_MEMBERS": "Ban Members",
|
||||||
|
"ADMINISTRATOR": "Administrator",
|
||||||
|
"MANAGE_CHANNELS": "Manage Channels",
|
||||||
|
"MANAGE_GUILD": "Manage Server",
|
||||||
|
"ADD_REACTIONS": "Add Reactions",
|
||||||
|
"VIEW_AUDIT_LOG": "View Audit Log",
|
||||||
|
"READ_MESSAGES": "Read Messages",
|
||||||
|
"SEND_MESSAGES": "Send Messages",
|
||||||
|
"SEND_TTS_MESSAGES": "Send TTS Messages",
|
||||||
|
"MANAGE_MESSAGES": "Manage Messages",
|
||||||
|
"EMBED_LINKS": "Embed Links",
|
||||||
|
"ATTACH_FILES": "Attach Files",
|
||||||
|
"READ_MESSAGE_HISTORY": "Read Message History",
|
||||||
|
"MENTION_EVERYONE": "Mention Everyone",
|
||||||
|
"USE_EXTERNAL_EMOJIS": "Use External Emojis",
|
||||||
|
"CONNECT": "Connect",
|
||||||
|
"SPEAK": "Speak",
|
||||||
|
"MUTE_MEMBERS": "Mute Members",
|
||||||
|
"DEAFEN_MEMBERS": "Deafen Members",
|
||||||
|
"MOVE_MEMBERS": "Move Members",
|
||||||
|
"USE_VAD": "Use Voice Activity",
|
||||||
|
"CHANGE_NICKNAME": "Change Nickname",
|
||||||
|
"MANAGE_NICKNAMES": "Manage Nicknames",
|
||||||
|
"MANAGE_ROLES": "Manage Roles",
|
||||||
|
"MANAGE_WEBHOOKS": "Manage Webhooks",
|
||||||
|
"MANAGE_EMOJIS": "Manage Emojis"
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
const Command = require('../../structures/Command');
|
||||||
|
const { MessageEmbed } = require('discord.js');
|
||||||
|
const moment = require('moment');
|
||||||
|
const perms = require('../../assets/json/permissions');
|
||||||
|
const { placeholder } = require('../../structures/Util');
|
||||||
|
|
||||||
|
module.exports = class RoleInfoCommand extends Command {
|
||||||
|
constructor(client) {
|
||||||
|
super(client, {
|
||||||
|
name: 'role-info',
|
||||||
|
aliases: ['role'],
|
||||||
|
group: 'guild-info',
|
||||||
|
memberName: 'role-info',
|
||||||
|
description: 'Responds with detailed information on a role.',
|
||||||
|
guildOnly: true,
|
||||||
|
clientPermissions: ['EMBED_LINKS'],
|
||||||
|
args: [
|
||||||
|
{
|
||||||
|
key: 'role',
|
||||||
|
prompt: 'Which role would you like to get info on?',
|
||||||
|
type: 'role'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
run(msg, args) {
|
||||||
|
const { role } = args;
|
||||||
|
const embed = new MessageEmbed()
|
||||||
|
.setColor(role.hexColor)
|
||||||
|
.setThumbnail(placeholder({ color: role.hexColor.replace('#', '') }))
|
||||||
|
.addField('❯ Name',
|
||||||
|
role.name, true)
|
||||||
|
.addField('❯ ID',
|
||||||
|
role.id, true)
|
||||||
|
.addField('❯ Creation Date',
|
||||||
|
moment(role.createdAt).format('MMMM Do YYYY'), true)
|
||||||
|
.addField('❯ Color',
|
||||||
|
role.hexColor.toUpperCase(), true)
|
||||||
|
.addField('❯ Hoisted',
|
||||||
|
role.hoist ? 'Yes' : 'No', true)
|
||||||
|
.addField('❯ Mentionable',
|
||||||
|
role.mentionable ? 'Yes' : 'No', true)
|
||||||
|
.addField('❯ Position',
|
||||||
|
msg.guild.roles.size - role.calculatedPosition, true)
|
||||||
|
.addField('❯ Permissions',
|
||||||
|
Object.keys(role.serialize()).filter((perm) => role.serialize()[perm]).map((perm) => perms[perm]));
|
||||||
|
return msg.embed(embed);
|
||||||
|
}
|
||||||
|
};
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiaobot",
|
"name": "xiaobot",
|
||||||
"version": "27.5.0",
|
"version": "27.6.0",
|
||||||
"description": "Your personal server companion.",
|
"description": "Your personal server companion.",
|
||||||
"main": "Shard.js",
|
"main": "Shard.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
const { Command } = require('discord.js-commando');
|
const { Command } = require('discord.js-commando');
|
||||||
|
const perms = require('../assets/json/permissions');
|
||||||
|
|
||||||
class XiaoCommand extends Command {
|
class XiaoCommand extends Command {
|
||||||
constructor(client, info) {
|
constructor(client, info) {
|
||||||
@@ -25,14 +26,14 @@ class XiaoCommand extends Command {
|
|||||||
if (this.clientPermissions) {
|
if (this.clientPermissions) {
|
||||||
for (const permission of this.clientPermissions) {
|
for (const permission of this.clientPermissions) {
|
||||||
if (!msg.channel.permissionsFor(this.client.user).has(permission)) {
|
if (!msg.channel.permissionsFor(this.client.user).has(permission)) {
|
||||||
return `This Command requires the \`${permission}\` Permission.`;
|
return `This Command requires the \`${perms[permission]}\` Permission.`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.userPermissions) {
|
if (this.userPermissions) {
|
||||||
for (const permission of this.userPermissions) {
|
for (const permission of this.userPermissions) {
|
||||||
if (!msg.channel.permissionsFor(msg.author).has(permission)) {
|
if (!msg.channel.permissionsFor(msg.author).has(permission)) {
|
||||||
return `You do not have the \`${permission}\` Permission.`;
|
return `You do not have the \`${perms[permission]}\` Permission.`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,11 @@ class Util {
|
|||||||
.replace(/(&)/g, '&')
|
.replace(/(&)/g, '&')
|
||||||
.replace(/(\[i\]|\[\/i\])/g, '*');
|
.replace(/(\[i\]|\[\/i\])/g, '*');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static placeholder({ size, color }) {
|
||||||
|
if (!size) size = '200x200';
|
||||||
|
return `http://via.placeholder.com/${size}/${color}/${color}`;
|
||||||
|
}
|
||||||
static dBots(count, id) {
|
static dBots(count, id) {
|
||||||
snekfetch
|
snekfetch
|
||||||
.post(`https://bots.discord.pw/api/bots/${id}/stats`)
|
.post(`https://bots.discord.pw/api/bots/${id}/stats`)
|
||||||
|
|||||||
Reference in New Issue
Block a user