mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Urban Command Change
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
const commando = require('discord.js-commando');
|
||||
const Discord = require('discord.js');
|
||||
const urban = require('urban');
|
||||
|
||||
class UrbanDictionary extends commando.Command {
|
||||
@@ -11,7 +12,7 @@ class UrbanDictionary extends commando.Command {
|
||||
examples: [';urban Cat']
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
async run(message, args) {
|
||||
if(message.channel.type !== 'dm') {
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission('SEND_MESSAGES')) return;
|
||||
@@ -24,10 +25,24 @@ class UrbanDictionary extends commando.Command {
|
||||
message.channel.sendMessage(":x: Error! Word not found!");
|
||||
} else if(json.definition === '') {
|
||||
message.channel.sendMessage(":x: Error! Word has no definition!");
|
||||
} else if(json.example === '') {
|
||||
message.channel.sendMessage("**Definition:**\n" + json.definition, {split:true});
|
||||
} else if(json.example !== '') {
|
||||
const embed = new Discord.RichEmbed()
|
||||
.setColor(0x32a8f0)
|
||||
.setAuthor('Urban Dictionary', 'http://a1.mzstatic.com/eu/r30/Purple71/v4/66/54/68/6654683f-cacd-4a55-1784-f14257f77874/icon175x175.png')
|
||||
.setURL(json.permalink)
|
||||
.setTitle(json.word)
|
||||
.setDescription(json.definition.substr(0, 1900) + '... [Read the Rest Here!](' + json.permalink + ')')
|
||||
.addField('**Example:**',
|
||||
json.example.substr(0, 1900));
|
||||
message.channel.sendEmbed(embed).catch(console.error);
|
||||
} else {
|
||||
message.channel.sendMessage("**Definition:**\n" + json.definition + "\n\n**Example:**\n" + json.example, {split:true});
|
||||
const embed = new Discord.RichEmbed()
|
||||
.setColor(0x32a8f0)
|
||||
.setAuthor('Urban Dictionary', 'http://a1.mzstatic.com/eu/r30/Purple71/v4/66/54/68/6654683f-cacd-4a55-1784-f14257f77874/icon175x175.png')
|
||||
.setURL(json.permalink)
|
||||
.setTitle(json.word)
|
||||
.setDescription(json.definition.substr(0, 1900) + '... [Read the Rest Here!](' + json.permalink + ')');
|
||||
message.channel.sendEmbed(embed).catch(console.error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user