mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-12 08:14:47 +02:00
Formatting
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
const commando = require('discord.js-commando');
|
||||
|
||||
module.exports = class CanYouNot extends commando.Command {
|
||||
constructor(Client){
|
||||
constructor(Client) {
|
||||
super(Client, {
|
||||
name: 'canyounot',
|
||||
group: 'random',
|
||||
@@ -12,10 +12,10 @@ module.exports = class CanYouNot extends commando.Command {
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
if(message.channel.type !== 'dm') {
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
if (message.channel.type !== 'dm') {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
}
|
||||
console.log("[Command] " + message.content);
|
||||
message.channel.send('Can YOU not?');
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const commando = require('discord.js-commando');
|
||||
|
||||
module.exports = class GiveFlowerCommand extends commando.Command {
|
||||
constructor(Client){
|
||||
constructor(Client) {
|
||||
super(Client, {
|
||||
name: 'giveflower',
|
||||
aliases: [
|
||||
@@ -16,10 +16,10 @@ module.exports = class GiveFlowerCommand extends commando.Command {
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
if(message.channel.type !== 'dm') {
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
if (message.channel.type !== 'dm') {
|
||||
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? ♪');
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const commando = require('discord.js-commando');
|
||||
|
||||
module.exports = class LennyCommand extends commando.Command {
|
||||
constructor(Client){
|
||||
constructor(Client) {
|
||||
super(Client, {
|
||||
name: 'lenny',
|
||||
group: 'random',
|
||||
@@ -12,10 +12,10 @@ module.exports = class LennyCommand extends commando.Command {
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
if(message.channel.type !== 'dm') {
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
if (message.channel.type !== 'dm') {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
}
|
||||
console.log("[Command] " + message.content);
|
||||
message.channel.send('( ͡° ͜ʖ ͡°)');
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const commando = require('discord.js-commando');
|
||||
|
||||
module.exports = class LotteryCommand extends commando.Command {
|
||||
constructor(Client){
|
||||
constructor(Client) {
|
||||
super(Client, {
|
||||
name: 'lottery',
|
||||
group: 'random',
|
||||
@@ -12,15 +12,16 @@ module.exports = class LotteryCommand extends commando.Command {
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
if(message.channel.type !== 'dm') {
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
if (message.channel.type !== 'dm') {
|
||||
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") {
|
||||
if (lotteryNumber === "Winner") {
|
||||
message.channel.send("Wow " + message.author.username + "! You actually won! Great job!");
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
message.channel.send("Nope, sorry, " + message.author.username + ", you lost.");
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
+18
-17
@@ -3,7 +3,7 @@ const Discord = require('discord.js');
|
||||
const math = require('mathjs');
|
||||
|
||||
module.exports = class MathGameCommand extends commando.Command {
|
||||
constructor(Client){
|
||||
constructor(Client) {
|
||||
super(Client, {
|
||||
name: 'mathgame',
|
||||
group: 'random',
|
||||
@@ -14,8 +14,8 @@ module.exports = class MathGameCommand extends commando.Command {
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
if(message.channel.type !== 'dm') {
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return;
|
||||
if (message.channel.type !== 'dm') {
|
||||
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);
|
||||
@@ -24,28 +24,29 @@ module.exports = class MathGameCommand extends commando.Command {
|
||||
let randomValue;
|
||||
switch (level) {
|
||||
case "easy":
|
||||
randomValue = 10;
|
||||
break;
|
||||
randomValue = 10;
|
||||
break;
|
||||
case "medium":
|
||||
randomValue = 50;
|
||||
break;
|
||||
randomValue = 50;
|
||||
break;
|
||||
case "hard":
|
||||
randomValue = 100;
|
||||
break;
|
||||
case "extreme":
|
||||
randomValue = 1000;
|
||||
break;
|
||||
randomValue = 100;
|
||||
break;
|
||||
case "extreme":
|
||||
randomValue = 1000;
|
||||
break;
|
||||
}
|
||||
let randomValue1 = Math.floor(Math.random() * randomValue) + 1;
|
||||
let randomValue2 = Math.floor(Math.random() * randomValue) + 1;
|
||||
let randomExpression = randomValue1 + randomType + randomValue2;
|
||||
let solved = math.eval(randomExpression);
|
||||
if(randomValue === undefined) {
|
||||
if (randomValue === undefined) {
|
||||
message.channel.send(':x: Error! No difficulty set! (Choose Easy, Medium, Hard, or Extreme)');
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
const embed = new Discord.RichEmbed()
|
||||
.setTitle('You have **ten** seconds to answer:')
|
||||
.setDescription(randomExpression);
|
||||
.setTitle('You have **ten** seconds to answer:')
|
||||
.setDescription(randomExpression);
|
||||
message.channel.sendEmbed(embed).then(() => {
|
||||
message.channel.awaitMessages(response => response.content === solved.toString() && response.author.id === message.author.id, {
|
||||
max: 1,
|
||||
@@ -59,4 +60,4 @@ module.exports = class MathGameCommand extends commando.Command {
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -2,7 +2,7 @@ const commando = require('discord.js-commando');
|
||||
const Discord = require('discord.js');
|
||||
|
||||
module.exports = class NitroCommand extends commando.Command {
|
||||
constructor(Client){
|
||||
constructor(Client) {
|
||||
super(Client, {
|
||||
name: 'nitro',
|
||||
group: 'random',
|
||||
@@ -13,16 +13,16 @@ module.exports = class NitroCommand extends commando.Command {
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
if(message.channel.type !== 'dm') {
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return;
|
||||
if (message.channel.type !== 'dm') {
|
||||
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()
|
||||
.setAuthor("Discord Nitro")
|
||||
.setThumbnail("https://pbs.twimg.com/profile_images/814184180649197568/y2eZcVMq.jpg")
|
||||
.setColor(0x748BD9)
|
||||
.setURL("https://discordapp.com/nitro")
|
||||
.setDescription("This Message can only be viewed by members with Discord Nitro.\n\n\n[More Information](https://discordapp.com/nitro)");
|
||||
.setAuthor("Discord Nitro")
|
||||
.setThumbnail("https://pbs.twimg.com/profile_images/814184180649197568/y2eZcVMq.jpg")
|
||||
.setColor(0x748BD9)
|
||||
.setURL("https://discordapp.com/nitro")
|
||||
.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);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const commando = require('discord.js-commando');
|
||||
|
||||
module.exports = class SlowClapCommand extends commando.Command {
|
||||
constructor(Client){
|
||||
constructor(Client) {
|
||||
super(Client, {
|
||||
name: 'slowclap',
|
||||
group: 'random',
|
||||
@@ -12,10 +12,10 @@ module.exports = class SlowClapCommand extends commando.Command {
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
if(message.channel.type !== 'dm') {
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
if (message.channel.type !== 'dm') {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
}
|
||||
console.log("[Command] " + message.content);
|
||||
message.channel.send('*slow clap*');
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -2,7 +2,7 @@ const commando = require('discord.js-commando');
|
||||
const sounds = require('./sounds.json');
|
||||
|
||||
module.exports = class SoundBoardCommand extends commando.Command {
|
||||
constructor(Client){
|
||||
constructor(Client) {
|
||||
super(Client, {
|
||||
name: 'soundboard',
|
||||
aliases: [
|
||||
@@ -17,48 +17,55 @@ module.exports = class SoundBoardCommand extends commando.Command {
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
if(message.channel.type !== 'dm') {
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
if (message.channel.type !== 'dm') {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
}
|
||||
console.log("[Command] " + message.content);
|
||||
if(message.channel.type !== 'dm') {
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission(['CONNECT', 'SPEAK', 'ADD_REACTIONS'])) {
|
||||
if (message.channel.type !== 'dm') {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission(['CONNECT', 'SPEAK', 'ADD_REACTIONS'])) {
|
||||
message.channel.send(':x: Error! In order to do this command, you must give me the permissions to "Connect" and "Speak", as well as the permission to Add Reactions!');
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
let voiceChannel = message.member.voiceChannel;
|
||||
if (!voiceChannel) {
|
||||
return message.channel.send(`:x: Error! Please be in a voice channel first!`);
|
||||
return message.channel.send(`:x: Error! Please be in a voice channel first!`);
|
||||
}
|
||||
let soundToPlay = message.content.toLowerCase().split(" ").slice(1).join(" ");
|
||||
if(soundToPlay === "") {
|
||||
message.channel.send(':x: Error! No sound set. Please use ;soundboard list to see a list of sounds you can play.');
|
||||
} else if(soundToPlay === 'list') {
|
||||
message.channel.send("**Available Sounds:** Cat, Pikachu, Vader, Doh, It's a Trap, Mario Death, Pokemon Center, Dun Dun Dun, Spongebob, Ugly Barnacle, Woo Hoo, Space, GLaDOS Bird, Airhorn, Zelda Chest, Eat my Shorts, No This is Patrick, Wumbo");
|
||||
} else if(soundToPlay === sounds.avaliable[soundToPlay]) {
|
||||
let soundToPlay = message.content.toLowerCase().split(" ").slice(1).join(" ");
|
||||
if (soundToPlay === "") {
|
||||
message.channel.send(':x: Error! No sound set. Please use ;soundboard list to see a list of sounds you can play.');
|
||||
}
|
||||
else if (soundToPlay === 'list') {
|
||||
message.channel.send("**Available Sounds:** Cat, Pikachu, Vader, Doh, It's a Trap, Mario Death, Pokemon Center, Dun Dun Dun, Spongebob, Ugly Barnacle, Woo Hoo, Space, GLaDOS Bird, Airhorn, Zelda Chest, Eat my Shorts, No This is Patrick, Wumbo");
|
||||
}
|
||||
else if (soundToPlay === sounds.avaliable[soundToPlay]) {
|
||||
let alreadyConnected = this.client.voiceConnections.get(voiceChannel.guild.id);
|
||||
if(alreadyConnected) {
|
||||
if(alreadyConnected.channel.id === voiceChannel.id) {
|
||||
message.channel.send(':x: Error! I am already playing a sound!');
|
||||
} else {
|
||||
if (alreadyConnected) {
|
||||
if (alreadyConnected.channel.id === voiceChannel.id) {
|
||||
message.channel.send(':x: Error! I am already playing a sound!');
|
||||
}
|
||||
else {
|
||||
message.channel.send(':x: Error! I am already playing a sound!');
|
||||
}
|
||||
} else {
|
||||
voiceChannel.join().then(connection => {
|
||||
let stream = sounds.paths[soundToPlay];
|
||||
let dispatcher = connection.playStream(stream);
|
||||
message.react('🔊');
|
||||
dispatcher.on('end', () => {
|
||||
voiceChannel.leave();
|
||||
message.react('✅');
|
||||
});
|
||||
});
|
||||
}
|
||||
} else {
|
||||
message.channel.send(':x: Error! Sound not found! Use `;soundboard list` to see a list of sounds you can play.');
|
||||
}
|
||||
else {
|
||||
voiceChannel.join().then(connection => {
|
||||
let stream = sounds.paths[soundToPlay];
|
||||
let dispatcher = connection.playStream(stream);
|
||||
message.react('🔊');
|
||||
dispatcher.on('end', () => {
|
||||
voiceChannel.leave();
|
||||
message.react('✅');
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
message.channel.send(':x: Error! Sound not found! Use `;soundboard list` to see a list of sounds you can play.');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
message.channel.send(':x: This is a DM!');
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -39,4 +39,4 @@
|
||||
"no this is patrick": "./sounds/no-this-is-patrick.mp3",
|
||||
"wumbo": "./sounds/wumbo.mp3"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const commando = require('discord.js-commando');
|
||||
|
||||
module.exports = class SpamCommand extends commando.Command {
|
||||
constructor(Client){
|
||||
constructor(Client) {
|
||||
super(Client, {
|
||||
name: 'spam',
|
||||
group: 'random',
|
||||
@@ -12,10 +12,10 @@ module.exports = class SpamCommand extends commando.Command {
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
if(message.channel.type !== 'dm') {
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'ATTACH_FILES'])) return;
|
||||
if (message.channel.type !== 'dm') {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'ATTACH_FILES'])) return;
|
||||
}
|
||||
console.log("[Command] " + message.content);
|
||||
message.channel.sendFile("./images/Spam.jpg");
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -2,7 +2,7 @@ const commando = require('discord.js-commando');
|
||||
const Discord = require('discord.js');
|
||||
|
||||
module.exports = class TypingGameCommand extends commando.Command {
|
||||
constructor(Client){
|
||||
constructor(Client) {
|
||||
super(Client, {
|
||||
name: 'typinggame',
|
||||
group: 'random',
|
||||
@@ -13,8 +13,8 @@ module.exports = class TypingGameCommand extends commando.Command {
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
if(message.channel.type !== 'dm') {
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return;
|
||||
if (message.channel.type !== 'dm') {
|
||||
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);
|
||||
@@ -23,39 +23,40 @@ module.exports = class TypingGameCommand extends commando.Command {
|
||||
let time;
|
||||
switch (level) {
|
||||
case "easy":
|
||||
time = 25000;
|
||||
break;
|
||||
time = 25000;
|
||||
break;
|
||||
case "medium":
|
||||
time = 20000;
|
||||
break;
|
||||
time = 20000;
|
||||
break;
|
||||
case "hard":
|
||||
time = 15000;
|
||||
break;
|
||||
case "extreme":
|
||||
time = 10000;
|
||||
break;
|
||||
time = 15000;
|
||||
break;
|
||||
case "extreme":
|
||||
time = 10000;
|
||||
break;
|
||||
}
|
||||
let levelWord;
|
||||
switch (level) {
|
||||
case "easy":
|
||||
levelWord = "twenty-five";
|
||||
break;
|
||||
levelWord = "twenty-five";
|
||||
break;
|
||||
case "medium":
|
||||
levelWord = "twenty";
|
||||
break;
|
||||
levelWord = "twenty";
|
||||
break;
|
||||
case "hard":
|
||||
levelWord = "fifteen";
|
||||
break;
|
||||
case "extreme":
|
||||
levelWord = "ten";
|
||||
break;
|
||||
levelWord = "fifteen";
|
||||
break;
|
||||
case "extreme":
|
||||
levelWord = "ten";
|
||||
break;
|
||||
}
|
||||
if(time === undefined) {
|
||||
if (time === undefined) {
|
||||
message.channel.send(':x: Error! No difficulty set! (Choose Easy, Medium, Hard, or Extreme)');
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
const embed = new Discord.RichEmbed()
|
||||
.setTitle('You have **' + levelWord + '** seconds to type:')
|
||||
.setDescription(randomSentence);
|
||||
.setTitle('You have **' + levelWord + '** seconds to type:')
|
||||
.setDescription(randomSentence);
|
||||
message.channel.sendEmbed(embed).then(() => {
|
||||
message.channel.awaitMessages(response => response.content === randomSentence && response.author.id === message.author.id, {
|
||||
max: 1,
|
||||
@@ -69,4 +70,4 @@ module.exports = class TypingGameCommand extends commando.Command {
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user