mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-09 01:04:16 +02:00
Remove all useless async
This commit is contained in:
@@ -11,11 +11,11 @@ module.exports = class CanYouNot extends commando.Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
run(message) {
|
||||
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?');
|
||||
return message.channel.send('Can YOU not?');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -15,11 +15,11 @@ module.exports = class GiveFlowerCommand extends commando.Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
run(message) {
|
||||
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? ♪');
|
||||
return message.channel.send('Ooh, what a pretty flower. What, I may have it? Thanks! I like flowers, yes? ♪');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -11,11 +11,11 @@ module.exports = class LennyCommand extends commando.Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
run(message) {
|
||||
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('( ͡° ͜ʖ ͡°)');
|
||||
return message.channel.send('( ͡° ͜ʖ ͡°)');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -11,17 +11,17 @@ module.exports = class LotteryCommand extends commando.Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
run(message) {
|
||||
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") {
|
||||
message.channel.send(`Wow ${message.author.username}! You actually won! Great job!`);
|
||||
return message.channel.send(`Wow ${message.author.username}! You actually won! Great job!`);
|
||||
}
|
||||
else {
|
||||
message.channel.send(`Nope, sorry ${message.author.username}, you lost.`);
|
||||
return message.channel.send(`Nope, sorry ${message.author.username}, you lost.`);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -41,7 +41,7 @@ module.exports = class MathGameCommand extends commando.Command {
|
||||
let randomExpression = randomValue1 + randomType + randomValue2;
|
||||
let solved = math.eval(randomExpression);
|
||||
if (!randomValue) {
|
||||
message.channel.send(':x: Error! No difficulty set! (Choose Easy, Medium, Hard, or Extreme)');
|
||||
return message.channel.send(':x: Error! No difficulty set! (Choose Easy, Medium, Hard, or Extreme)');
|
||||
}
|
||||
else {
|
||||
const embed = new Discord.RichEmbed()
|
||||
@@ -54,10 +54,10 @@ module.exports = class MathGameCommand extends commando.Command {
|
||||
time: 10000,
|
||||
errors: ['time'],
|
||||
});
|
||||
message.channel.send(`Good Job! You won! ${solved} is the correct answer!`);
|
||||
return message.channel.send(`Good Job! You won! ${solved} is the correct answer!`);
|
||||
}
|
||||
catch (err) {
|
||||
message.channel.send(`Aw... Too bad, try again next time!\nThe correct answer is: ${solved}`);
|
||||
return message.channel.send(`Aw... Too bad, try again next time!\nThe correct answer is: ${solved}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ module.exports = class NitroCommand extends commando.Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
run(message) {
|
||||
if (message.channel.type !== 'dm') {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return;
|
||||
}
|
||||
@@ -23,6 +23,6 @@ module.exports = class NitroCommand extends commando.Command {
|
||||
.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);
|
||||
return message.channel.sendEmbed(embed);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -37,14 +37,14 @@ module.exports = class QuizCommand extends commando.Command {
|
||||
time: 15000,
|
||||
errors: ['time']
|
||||
});
|
||||
message.channel.send(`Good Job! You won! ${response.body[0].answer} is the correct answer!`);
|
||||
return message.channel.send(`Good Job! You won! ${response.body[0].answer} is the correct answer!`);
|
||||
}
|
||||
catch (err) {
|
||||
message.channel.send(`Aw... Too bad, try again next time!\nThe Correct Answer was: ${response.body[0].answer}`);
|
||||
return message.channel.send(`Aw... Too bad, try again next time!\nThe Correct Answer was: ${response.body[0].answer}`);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
message.channel.send(":x: Error! Something went wrong!");
|
||||
return message.channel.send(":x: Error! Something went wrong!");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -11,11 +11,11 @@ module.exports = class SlowClapCommand extends commando.Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
run(message) {
|
||||
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*');
|
||||
return message.channel.send('*slow clap*');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -23,29 +23,29 @@ module.exports = class SoundBoardCommand extends commando.Command {
|
||||
console.log(`[Command] ${message.content}`);
|
||||
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!');
|
||||
return 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 {
|
||||
let voiceChannel = message.member.voiceChannel;
|
||||
if (!voiceChannel) {
|
||||
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!`);
|
||||
}
|
||||
else {
|
||||
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.');
|
||||
return 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");
|
||||
return 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 = await 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!');
|
||||
return message.channel.send(':x: Error! I am already playing a sound!');
|
||||
}
|
||||
else {
|
||||
message.channel.send(':x: Error! I am already playing a sound!');
|
||||
return message.channel.send(':x: Error! I am already playing a sound!');
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -60,13 +60,13 @@ module.exports = class SoundBoardCommand extends commando.Command {
|
||||
}
|
||||
}
|
||||
else {
|
||||
message.channel.send(':x: Error! Sound not found! Use `;soundboard list` to see a list of sounds you can play.');
|
||||
return 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!');
|
||||
return message.channel.send(':x: This is a DM!');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -11,11 +11,11 @@ module.exports = class SpamCommand extends commando.Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
run(message) {
|
||||
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");
|
||||
return message.channel.sendFile("./images/Spam.jpg");
|
||||
}
|
||||
};
|
||||
|
||||
@@ -37,11 +37,10 @@ module.exports = class TodayCommand extends commando.Command {
|
||||
.setTitle(`On this day (${responseData.date})...`)
|
||||
.setTimestamp()
|
||||
.setDescription(`${responseData.data.Events[randomNumber].text} (${responseData.data.Events[randomNumber].year})`);
|
||||
message.channel.sendEmbed(embed);
|
||||
return message.channel.sendEmbed(embed);
|
||||
}
|
||||
catch (err) {
|
||||
console.log(err);
|
||||
message.channel.send(":x: Error! Something went wrong!");
|
||||
return message.channel.send(":x: Error! Something went wrong!");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -51,7 +51,7 @@ module.exports = class TypingGameCommand extends commando.Command {
|
||||
break;
|
||||
}
|
||||
if (!time) {
|
||||
message.channel.send(':x: Error! No difficulty set! (Choose Easy, Medium, Hard, or Extreme)');
|
||||
return message.channel.send(':x: Error! No difficulty set! (Choose Easy, Medium, Hard, or Extreme)');
|
||||
}
|
||||
else {
|
||||
const embed = new Discord.RichEmbed()
|
||||
@@ -64,10 +64,10 @@ module.exports = class TypingGameCommand extends commando.Command {
|
||||
time: time,
|
||||
errors: ['time']
|
||||
});
|
||||
message.channel.send(`Good Job! You won!`);
|
||||
return message.channel.send(`Good Job! You won!`);
|
||||
}
|
||||
catch (err) {
|
||||
message.channel.send('Aw... Too bad, try again next time!');
|
||||
return message.channel.send('Aw... Too bad, try again next time!');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user