mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-18 21:40:49 +02:00
Huge Modification to Code
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
const commando = require('discord.js-commando');
|
||||
|
||||
class CanYouNot extends commando.Command {
|
||||
module.exports = class CanYouNot extends commando.Command {
|
||||
constructor(Client){
|
||||
super(Client, {
|
||||
name: 'canyounot',
|
||||
name: 'canyounot',
|
||||
group: 'random',
|
||||
memberName: 'canyounot',
|
||||
description: 'Can YOU not? (;canyounot)',
|
||||
@@ -11,14 +11,11 @@ class CanYouNot extends commando.Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
async run(message) {
|
||||
if(message.channel.type !== 'dm') {
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission('SEND_MESSAGES')) return;
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission('READ_MESSAGES')) return;
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
}
|
||||
console.log("[Command] " + message.content);
|
||||
message.channel.send('Can YOU not?');
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = CanYouNot;
|
||||
};
|
||||
@@ -1,9 +1,13 @@
|
||||
const commando = require('discord.js-commando');
|
||||
|
||||
class GiveFlowerCommand extends commando.Command {
|
||||
module.exports = class GiveFlowerCommand extends commando.Command {
|
||||
constructor(Client){
|
||||
super(Client, {
|
||||
name: 'giveflower',
|
||||
name: 'giveflower',
|
||||
aliases: [
|
||||
'present',
|
||||
'gift'
|
||||
],
|
||||
group: 'random',
|
||||
memberName: 'giveflower',
|
||||
description: 'Gives Xiao Pai a flower. (;giveflower)',
|
||||
@@ -11,14 +15,11 @@ class GiveFlowerCommand extends commando.Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
async run(message) {
|
||||
if(message.channel.type !== 'dm') {
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission('SEND_MESSAGES')) return;
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission('READ_MESSAGES')) return;
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
}
|
||||
console.log("[Command] " + message.content);
|
||||
message.channel.send('Ooh, what a pretty flower. What, I may have it? Thanks! I like flowers, yes? ♪');
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = GiveFlowerCommand;
|
||||
};
|
||||
@@ -1,9 +1,9 @@
|
||||
const commando = require('discord.js-commando');
|
||||
|
||||
class LennyCommand extends commando.Command {
|
||||
module.exports = class LennyCommand extends commando.Command {
|
||||
constructor(Client){
|
||||
super(Client, {
|
||||
name: 'lenny',
|
||||
name: 'lenny',
|
||||
group: 'random',
|
||||
memberName: 'lenny',
|
||||
description: 'Responds with the lenny face. (;lenny)',
|
||||
@@ -11,14 +11,11 @@ class LennyCommand extends commando.Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
async run(message) {
|
||||
if(message.channel.type !== 'dm') {
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission('SEND_MESSAGES')) return;
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission('READ_MESSAGES')) return;
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
}
|
||||
console.log("[Command] " + message.content);
|
||||
message.channel.send('( ͡° ͜ʖ ͡°)');
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = LennyCommand;
|
||||
};
|
||||
@@ -1,9 +1,9 @@
|
||||
const commando = require('discord.js-commando');
|
||||
|
||||
class LotteryCommand extends commando.Command {
|
||||
module.exports = class LotteryCommand extends commando.Command {
|
||||
constructor(Client){
|
||||
super(Client, {
|
||||
name: 'lottery',
|
||||
name: 'lottery',
|
||||
group: 'random',
|
||||
memberName: 'lottery',
|
||||
description: '1 in 100 Chance of Winning. Winners get... The feeling of winning? (;lottery)',
|
||||
@@ -11,19 +11,16 @@ class LotteryCommand extends commando.Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
async run(message) {
|
||||
if(message.channel.type !== 'dm') {
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission('SEND_MESSAGES')) return;
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission('READ_MESSAGES')) return;
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
}
|
||||
console.log("[Command] " + message.content);
|
||||
let lotterynumber = ['Winner'][Math.floor(Math.random() * 100)];
|
||||
if(lotterynumber === "Winner") {
|
||||
let lotteryNumber = ['Winner'][Math.floor(Math.random() * 100)];
|
||||
if(lotteryNumber === "Winner") {
|
||||
message.channel.send("Wow " + message.author.username + "! You actually won! Great job!");
|
||||
} else {
|
||||
message.channel.send("Nope, sorry, " + message.author.username + ", you lost. RIP you.");
|
||||
message.channel.send("Nope, sorry, " + message.author.username + ", you lost.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = LotteryCommand;
|
||||
};
|
||||
@@ -2,10 +2,10 @@ const commando = require('discord.js-commando');
|
||||
const Discord = require('discord.js');
|
||||
const math = require('mathjs');
|
||||
|
||||
class MathGameCommand extends commando.Command {
|
||||
module.exports = class MathGameCommand extends commando.Command {
|
||||
constructor(Client){
|
||||
super(Client, {
|
||||
name: 'mathgame',
|
||||
name: 'mathgame',
|
||||
group: 'random',
|
||||
memberName: 'mathgame',
|
||||
description: 'See how fast you can answer a math problem in a given time limit. (;mathgame easy)',
|
||||
@@ -13,11 +13,9 @@ class MathGameCommand extends commando.Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
async run(message) {
|
||||
if(message.channel.type !== 'dm') {
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission('SEND_MESSAGES')) return;
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission('READ_MESSAGES')) return;
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS')) return;
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return;
|
||||
}
|
||||
console.log("[Command] " + message.content);
|
||||
let [level] = message.content.toLowerCase().split(" ").slice(1);
|
||||
@@ -61,6 +59,4 @@ class MathGameCommand extends commando.Command {
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = MathGameCommand;
|
||||
};
|
||||
@@ -1,10 +1,10 @@
|
||||
const commando = require('discord.js-commando');
|
||||
const Discord = require('discord.js');
|
||||
|
||||
class NitroCommand extends commando.Command {
|
||||
module.exports = class NitroCommand extends commando.Command {
|
||||
constructor(Client){
|
||||
super(Client, {
|
||||
name: 'nitro',
|
||||
name: 'nitro',
|
||||
group: 'random',
|
||||
memberName: 'nitro',
|
||||
description: 'Sends a "This Message Can Only be viewed by Nitro Members" message. (;nitro)',
|
||||
@@ -12,11 +12,9 @@ class NitroCommand extends commando.Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
async run(message) {
|
||||
if(message.channel.type !== 'dm') {
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission('SEND_MESSAGES')) return;
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission('READ_MESSAGES')) return;
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS')) return;
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return;
|
||||
}
|
||||
console.log("[Command] " + message.content);
|
||||
const embed = new Discord.RichEmbed()
|
||||
@@ -27,6 +25,4 @@ class NitroCommand extends commando.Command {
|
||||
.setDescription("This Message can only be viewed by members with Discord Nitro.\n\n\n[More Information](https://discordapp.com/nitro)");
|
||||
message.channel.sendEmbed(embed).catch(console.error);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = NitroCommand;
|
||||
};
|
||||
@@ -1,9 +1,9 @@
|
||||
const commando = require('discord.js-commando');
|
||||
|
||||
class SlowClapCommand extends commando.Command {
|
||||
module.exports = class SlowClapCommand extends commando.Command {
|
||||
constructor(Client){
|
||||
super(Client, {
|
||||
name: 'slowclap',
|
||||
name: 'slowclap',
|
||||
group: 'random',
|
||||
memberName: 'slowclap',
|
||||
description: '*Slow Clap*. (;slowclap)',
|
||||
@@ -11,14 +11,11 @@ class SlowClapCommand extends commando.Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
async run(message) {
|
||||
if(message.channel.type !== 'dm') {
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission('SEND_MESSAGES')) return;
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission('READ_MESSAGES')) return;
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
}
|
||||
console.log("[Command] " + message.content);
|
||||
message.channel.send('*slow clap*');
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = SlowClapCommand;
|
||||
};
|
||||
@@ -1,10 +1,14 @@
|
||||
const commando = require('discord.js-commando');
|
||||
const sounds = require('./sounds.json');
|
||||
|
||||
class SoundBoardCommand extends commando.Command {
|
||||
module.exports = class SoundBoardCommand extends commando.Command {
|
||||
constructor(Client){
|
||||
super(Client, {
|
||||
name: 'soundboard',
|
||||
name: 'soundboard',
|
||||
aliases: [
|
||||
'sound',
|
||||
'play'
|
||||
],
|
||||
group: 'random',
|
||||
memberName: 'soundboard',
|
||||
description: 'Plays a sound in your voice channel. (;soundboard cat)',
|
||||
@@ -12,10 +16,9 @@ class SoundBoardCommand extends commando.Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
async run(message) {
|
||||
if(message.channel.type !== 'dm') {
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission('SEND_MESSAGES')) return;
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission('READ_MESSAGES')) return;
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
}
|
||||
console.log("[Command] " + message.content);
|
||||
if(message.channel.type !== 'dm') {
|
||||
@@ -40,9 +43,9 @@ class SoundBoardCommand extends commando.Command {
|
||||
message.channel.send(':x: Error! I am already playing a sound!');
|
||||
}
|
||||
} else {
|
||||
voiceChannel.join().then(connnection => {
|
||||
voiceChannel.join().then(connection => {
|
||||
let stream = sounds.paths[soundToPlay];
|
||||
let dispatcher = connnection.playStream(stream);
|
||||
let dispatcher = connection.playStream(stream);
|
||||
message.react('🔊');
|
||||
dispatcher.on('end', () => {
|
||||
voiceChannel.leave();
|
||||
@@ -51,13 +54,11 @@ class SoundBoardCommand extends commando.Command {
|
||||
});
|
||||
}
|
||||
} else {
|
||||
message.channel.send(':x: Error! Sound not found! Please use ;soundboard list to see a list of sounds you can play.');
|
||||
message.channel.send(':x: Error! Sound not found! Use `;soundboard list` to see a list of sounds you can play.');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
message.channel.send(':x: This is a DM!');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = SoundBoardCommand;
|
||||
};
|
||||
+5
-10
@@ -1,9 +1,9 @@
|
||||
const commando = require('discord.js-commando');
|
||||
|
||||
class SpamCommand extends commando.Command {
|
||||
module.exports = class SpamCommand extends commando.Command {
|
||||
constructor(Client){
|
||||
super(Client, {
|
||||
name: 'spam',
|
||||
name: 'spam',
|
||||
group: 'random',
|
||||
memberName: 'spam',
|
||||
description: 'Puts a picture of Spam. (;spam)',
|
||||
@@ -11,16 +11,11 @@ class SpamCommand extends commando.Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
async run(message) {
|
||||
if(message.channel.type !== 'dm') {
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission('SEND_MESSAGES')) return;
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission('READ_MESSAGES')) return;
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission('ATTACH_FILES')) return;
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'ATTACH_FILES'])) return;
|
||||
}
|
||||
console.log("[Command] " + message.content);
|
||||
message.channel.send("Spam!");
|
||||
message.channel.sendFile("./images/Spam.jpg");
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = SpamCommand;
|
||||
};
|
||||
+16
-20
@@ -1,11 +1,14 @@
|
||||
const commando = require('discord.js-commando');
|
||||
const Discord = require('discord.js');
|
||||
const request = require('request-promise');
|
||||
const request = require('superagent');
|
||||
|
||||
class TodayCommand extends commando.Command {
|
||||
module.exports = class TodayCommand extends commando.Command {
|
||||
constructor(Client){
|
||||
super(Client, {
|
||||
name: 'today',
|
||||
name: 'today',
|
||||
aliases: [
|
||||
'history'
|
||||
],
|
||||
group: 'random',
|
||||
memberName: 'today',
|
||||
description: 'Tells you what happened today. (;today)',
|
||||
@@ -13,31 +16,24 @@ class TodayCommand extends commando.Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
async run(message) {
|
||||
if(message.channel.type !== 'dm') {
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission('SEND_MESSAGES')) return;
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission('READ_MESSAGES')) return;
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS')) return;
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return;
|
||||
}
|
||||
console.log("[Command] " + message.content);
|
||||
const options = {
|
||||
method: 'GET',
|
||||
uri: 'http://history.muffinlabs.com/date',
|
||||
json: true
|
||||
}
|
||||
request(options).then(function (response) {
|
||||
let randomNumber = Math.floor(Math.random() * response.data.Events.length);
|
||||
request
|
||||
.get('http://history.muffinlabs.com/date')
|
||||
.then(function (response) {
|
||||
let randomNumber = Math.floor(Math.random() * response.body.data.Events.length);
|
||||
const embed = new Discord.RichEmbed()
|
||||
.setColor(0x9797FF)
|
||||
.setURL(response.url)
|
||||
.setTitle('On this day (' + response.date + ')...')
|
||||
.setURL(response.body.url)
|
||||
.setTitle('On this day (' + response.body.date + ')...')
|
||||
.setTimestamp()
|
||||
.setDescription(response.data.Events[randomNumber].text + ' (' + response.data.Events[randomNumber].year + ')');
|
||||
.setDescription(response.body.data.Events[randomNumber].text + ' (' + response.body.data.Events[randomNumber].year + ')');
|
||||
message.channel.sendEmbed(embed).catch(console.error);
|
||||
}).catch(function (err) {
|
||||
message.channel.send(":x: Error! Something went wrong!");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = TodayCommand;
|
||||
};
|
||||
@@ -1,10 +1,10 @@
|
||||
const commando = require('discord.js-commando');
|
||||
const Discord = require('discord.js');
|
||||
|
||||
class TypingGameCommand extends commando.Command {
|
||||
module.exports = class TypingGameCommand extends commando.Command {
|
||||
constructor(Client){
|
||||
super(Client, {
|
||||
name: 'typinggame',
|
||||
name: 'typinggame',
|
||||
group: 'random',
|
||||
memberName: 'typinggame',
|
||||
description: 'See how fast you can type a sentence in a given time limit. (;typinggame easy)',
|
||||
@@ -12,11 +12,9 @@ class TypingGameCommand extends commando.Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
async run(message) {
|
||||
if(message.channel.type !== 'dm') {
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission('SEND_MESSAGES')) return;
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission('READ_MESSAGES')) return;
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS')) return;
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return;
|
||||
}
|
||||
console.log("[Command] " + message.content);
|
||||
let [level] = message.content.toLowerCase().split(" ").slice(1);
|
||||
@@ -71,6 +69,4 @@ class TypingGameCommand extends commando.Command {
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = TypingGameCommand;
|
||||
};
|
||||
Reference in New Issue
Block a user