mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-24 02:15:10 +02:00
Huge Modification to Code
This commit is contained in:
+12
-11
@@ -1,10 +1,14 @@
|
||||
const commando = require('discord.js-commando');
|
||||
const pirateSpeak = require('pirate-speak');
|
||||
|
||||
class PirateCommand extends commando.Command {
|
||||
module.exports = class PirateCommand extends commando.Command {
|
||||
constructor(Client){
|
||||
super(Client, {
|
||||
name: 'pirate',
|
||||
name: 'pirate',
|
||||
aliases: [
|
||||
'piratespeak',
|
||||
'yarr'
|
||||
],
|
||||
group: 'textedit',
|
||||
memberName: 'pirate',
|
||||
description: 'Talk like a pirate! (;pirate This is being said like a pirate!)',
|
||||
@@ -12,15 +16,14 @@ class PirateCommand 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 messagecontent = message.content.split(" ").slice(1).join(" ");
|
||||
let pirate = pirateSpeak.translate(messagecontent);
|
||||
if(messagecontent === "") {
|
||||
let turnToPirate = message.content.split(" ").slice(1).join(" ");
|
||||
let pirate = pirateSpeak.translate(turnToPirate);
|
||||
if(turnToPirate === "") {
|
||||
message.channel.send(":x: Error! Nothing to translate!");
|
||||
} else {
|
||||
if(pirate.length > 1950) {
|
||||
@@ -30,6 +33,4 @@ class PirateCommand extends commando.Command {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = PirateCommand;
|
||||
};
|
||||
Reference in New Issue
Block a user