mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-10 19:04:42 +02:00
Merge Xiao and Fidget
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const { stripIndents } = require('common-tags');
|
||||
const roles = require('../../assets/json/roles');
|
||||
|
||||
module.exports = class RolelistCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'role-list',
|
||||
aliases: ['roles'],
|
||||
group: 'role-manage',
|
||||
memberName: 'role-list',
|
||||
description: 'Responds with all available roles in this server.',
|
||||
guildOnly: true
|
||||
});
|
||||
}
|
||||
|
||||
run(msg) {
|
||||
if (!roles[msg.guild.id]) return msg.say('This server has no roles open...');
|
||||
return msg.say(stripIndents`
|
||||
**Roles available in ${msg.guild.name}**:
|
||||
${msg.guild.roles.filter(role => roles[msg.guild.id].includes(role.id)).map(role => role.name).join('\n')}
|
||||
`);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const roles = require('../../assets/json/roles');
|
||||
|
||||
module.exports = class SubscribeCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'subscribe',
|
||||
aliases: ['join'],
|
||||
group: 'role-manage',
|
||||
memberName: 'subscribe',
|
||||
description: 'Subscribes you to the specified role.',
|
||||
guildOnly: true,
|
||||
clientPermissions: ['MANAGE_ROLES'],
|
||||
args: [
|
||||
{
|
||||
key: 'role',
|
||||
prompt: 'What role do you want to subscribe to?',
|
||||
type: 'role'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { role }) {
|
||||
if (!roles[msg.guild.id]) return msg.say('This server has no roles open...');
|
||||
if (!roles[msg.guild.id].includes(role.id)) return msg.reply('This role is not open!');
|
||||
if (!role.editable) return msg.reply('I do not have permission to manage this role!');
|
||||
if (msg.member.roles.has(role.id)) return msg.reply('You are already a member of this role!');
|
||||
await msg.member.addRole(role);
|
||||
return msg.say(`You were added to **${role.name}**!`);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const roles = require('../../assets/json/roles');
|
||||
|
||||
module.exports = class UnsubscribeCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'unsubscribe',
|
||||
aliases: ['leave'],
|
||||
group: 'role-manage',
|
||||
memberName: 'unsubscribe',
|
||||
description: 'Unsubscribes you from the specified role.',
|
||||
guildOnly: true,
|
||||
clientPermissions: ['MANAGE_ROLES'],
|
||||
args: [
|
||||
{
|
||||
key: 'role',
|
||||
prompt: 'What role do you want to unsubscribe from?',
|
||||
type: 'role'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { role }) {
|
||||
if (!roles[msg.guild.id]) return msg.say('This server has no roles open...');
|
||||
if (!roles[msg.guild.id].includes(role.id)) return msg.reply('This role is not open!');
|
||||
if (!role.editable) return msg.reply('I do not have permission to manage this role!');
|
||||
if (!msg.member.roles.has(role.id)) return msg.reply('You are not a member of this role!');
|
||||
await msg.member.removeRole(role);
|
||||
return msg.say(`You were removed from **${role.name}**...`);
|
||||
}
|
||||
};
|
||||
@@ -61,7 +61,7 @@ module.exports = class TwitterCommand extends Command {
|
||||
}
|
||||
|
||||
async fetchToken() {
|
||||
const auth = new Buffer(`${TWITTER_KEY}:${TWITTER_SECRET}`).toString('base64');
|
||||
const auth = Buffer.from(`${TWITTER_KEY}:${TWITTER_SECRET}`).toString('base64');
|
||||
const { body } = await snekfetch
|
||||
.post('https://api.twitter.com/oauth2/token')
|
||||
.set({
|
||||
|
||||
Reference in New Issue
Block a user