mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-09 01:04:16 +02:00
Switch to Wordnik (Temp API Key)
This commit is contained in:
@@ -61,7 +61,7 @@ class InfoCommand extends commando.Command {
|
|||||||
.addField('Packages',
|
.addField('Packages',
|
||||||
"[Commando](https://github.com/Gawdl3y/discord.js-commando) (0.9.0), [cleverbot-node](https://github.com/fojas/cleverbot-node) (0.3.5), [pirate-speak](https://github.com/mikewesthad/pirate-speak) (1.0.1), [JIMP](https://github.com/oliver-moran/jimp) (0.2.27), [google-translate-api](https://github.com/matheuss/google-translate-api) (2.2.2), [urban](https://github.com/mvrilo/urban) (0.3.1), [zalgoize](https://github.com/clux/zalgolize) (1.2.4), [hepburn](https://github.com/lovell/hepburn) (1.0.0), [wikifakt](https://github.com/coffee-cup/wikifakt) (1.0.3), [osu](https://github.com/IOExceptionOsu/node-osu) (1.0.1), [yahoo-weather](https://github.com/mamal72/node-yahoo-weather) (2.2.2), [imdb-api](https://github.com/worr/node-imdb-api) (2.2.1), [request-promise](https://github.com/request/request-promise) (4.1.1)")
|
"[Commando](https://github.com/Gawdl3y/discord.js-commando) (0.9.0), [cleverbot-node](https://github.com/fojas/cleverbot-node) (0.3.5), [pirate-speak](https://github.com/mikewesthad/pirate-speak) (1.0.1), [JIMP](https://github.com/oliver-moran/jimp) (0.2.27), [google-translate-api](https://github.com/matheuss/google-translate-api) (2.2.2), [urban](https://github.com/mvrilo/urban) (0.3.1), [zalgoize](https://github.com/clux/zalgolize) (1.2.4), [hepburn](https://github.com/lovell/hepburn) (1.0.0), [wikifakt](https://github.com/coffee-cup/wikifakt) (1.0.3), [osu](https://github.com/IOExceptionOsu/node-osu) (1.0.1), [yahoo-weather](https://github.com/mamal72/node-yahoo-weather) (2.2.2), [imdb-api](https://github.com/worr/node-imdb-api) (2.2.1), [request-promise](https://github.com/request/request-promise) (4.1.1)")
|
||||||
.addField('Other Credit',
|
.addField('Other Credit',
|
||||||
"[Cleverbot API](https://www.cleverbot.com/api/), [Wattpad API](https://developer.wattpad.com/docs/api), [OwlBot Defenition API](https://owlbot.info/api/v1/dictionary/owl)")
|
"[Cleverbot API](https://www.cleverbot.com/api/), [Wattpad API](https://developer.wattpad.com/docs/api), [Wordnik API](http://developer.wordnik.com/docs.html)")
|
||||||
.addField('My Server',
|
.addField('My Server',
|
||||||
"[Click Here to Join!](https://discord.gg/fqQF8mc)")
|
"[Click Here to Join!](https://discord.gg/fqQF8mc)")
|
||||||
.addField('Invite Link:',
|
.addField('Invite Link:',
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
const commando = require('discord.js-commando');
|
const commando = require('discord.js-commando');
|
||||||
const Discord = require('discord.js');
|
const Discord = require('discord.js');
|
||||||
const request = require('request-promise');
|
const request = require('request-promise');
|
||||||
|
const config = require('../../config.json');
|
||||||
|
|
||||||
class DefineCommand extends commando.Command {
|
class DefineCommand extends commando.Command {
|
||||||
constructor(Client){
|
constructor(Client){
|
||||||
@@ -8,7 +9,7 @@ class DefineCommand extends commando.Command {
|
|||||||
name: 'define',
|
name: 'define',
|
||||||
group: 'search',
|
group: 'search',
|
||||||
memberName: 'define',
|
memberName: 'define',
|
||||||
description: 'Defines the first word in your message. (;define Cat)',
|
description: 'Defines a word. (;define Cat)',
|
||||||
examples: [';define Cat']
|
examples: [';define Cat']
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -20,17 +21,17 @@ class DefineCommand extends commando.Command {
|
|||||||
if(!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS')) return;
|
if(!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS')) return;
|
||||||
}
|
}
|
||||||
console.log("[Command] " + message.content);
|
console.log("[Command] " + message.content);
|
||||||
let [definethis] = message.content.toLowerCase().split(" ").slice(1);
|
let definethis = message.content.toLowerCase().split(" ").slice(1).join("%20");
|
||||||
const options = {
|
const options = {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
uri: 'https://owlbot.info/api/v1/dictionary/' + definethis + '?format=json',
|
uri: 'http://api.wordnik.com:80/v4/word.json/' + definethis + '/definitions?limit=1&includeRelated=false&useCanonical=false&includeTags=false&api_key=' + config.wordnikkey,
|
||||||
json: true
|
json: true
|
||||||
}
|
}
|
||||||
request(options).then(function (response) {
|
request(options).then(function (response) {
|
||||||
const embed = new Discord.RichEmbed()
|
const embed = new Discord.RichEmbed()
|
||||||
.setColor(0x0000FF)
|
.setColor(0x0000FF)
|
||||||
.setTitle(definethis)
|
.setTitle(response[0].word)
|
||||||
.setDescription(response[0].defenition);
|
.setDescription(response[0].text);
|
||||||
message.channel.sendEmbed(embed).catch(console.error);
|
message.channel.sendEmbed(embed).catch(console.error);
|
||||||
}).catch(function (err) {
|
}).catch(function (err) {
|
||||||
message.channel.sendMessage(":x: Error! Word not Found!");
|
message.channel.sendMessage(":x: Error! Word not Found!");
|
||||||
|
|||||||
Reference in New Issue
Block a user