Merge Xiao and Fidget

This commit is contained in:
Daniel Odendahl Jr
2017-12-07 19:15:49 +00:00
parent 6fecc265bd
commit f6d49a4ce6
7 changed files with 153 additions and 2 deletions
+24
View File
@@ -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')}
`);
}
};
+32
View File
@@ -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}**!`);
}
};
+32
View File
@@ -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}**...`);
}
};
+1 -1
View File
@@ -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({