mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 15:07:42 +02:00
Remove "osu" dependency
This commit is contained in:
@@ -58,8 +58,8 @@ class InfoCommand extends commando.Command {
|
||||
"[View Here](https://github.com/dragonfire535/xiaobot)", true)
|
||||
.addField('Lib',
|
||||
"[discord.js](https://discord.js.org/#/) (master)", true)
|
||||
.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)")
|
||||
.addField('Modules',
|
||||
"[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), [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',
|
||||
"[Cleverbot API](https://www.cleverbot.com/api/), [Wattpad API](https://developer.wattpad.com/docs/api), [Wordnik API](http://developer.wordnik.com/docs.html), [osu! API](https://osu.ppy.sh/p/api)")
|
||||
.addField('My Server',
|
||||
|
||||
+27
-18
@@ -1,7 +1,7 @@
|
||||
const commando = require('discord.js-commando');
|
||||
const Discord = require('discord.js');
|
||||
const config = require('../../config.json');
|
||||
const osu = require('osu')(config.osukey);
|
||||
const request = require('request-promise');
|
||||
|
||||
class OsuCommand extends commando.Command {
|
||||
constructor(Client){
|
||||
@@ -22,11 +22,18 @@ class OsuCommand extends commando.Command {
|
||||
}
|
||||
console.log("[Command] " + message.content);
|
||||
let usernametosearch = message.content.split(" ").slice(1).join(" ");
|
||||
osu.get_user({
|
||||
"u": usernametosearch,
|
||||
"type": 'string'
|
||||
}, function(result) {
|
||||
if(result[0] === undefined) {
|
||||
const options = {
|
||||
method: 'GET',
|
||||
uri: 'https://osu.ppy.sh/api/get_user',
|
||||
qs: {
|
||||
k: config.osukey,
|
||||
u: usernametosearch,
|
||||
type: "string"
|
||||
},
|
||||
json: true
|
||||
}
|
||||
request(options).then(function (response) {
|
||||
if(response[0] === undefined) {
|
||||
message.channel.sendMessage(":x: Error! User not found!");
|
||||
} else {
|
||||
const embed = new Discord.RichEmbed()
|
||||
@@ -34,31 +41,33 @@ class OsuCommand extends commando.Command {
|
||||
.setAuthor('osu!', 'http://vignette3.wikia.nocookie.net/osugame/images/c/c9/Logo.png/revision/latest?cb=20151219073209')
|
||||
.setURL('https://osu.ppy.sh/')
|
||||
.addField('**Username:**',
|
||||
result[0].username, true)
|
||||
response[0].username, true)
|
||||
.addField('**ID:**',
|
||||
result[0].user_id, true)
|
||||
response[0].user_id, true)
|
||||
.addField('**Level:**',
|
||||
result[0].level, true)
|
||||
response[0].level, true)
|
||||
.addField('**Accuracy**',
|
||||
result[0].accuracy, true)
|
||||
response[0].accuracy, true)
|
||||
.addField('**Rank:**',
|
||||
result[0].pp_rank, true)
|
||||
response[0].pp_rank, true)
|
||||
.addField('**Play Count:**',
|
||||
result[0].playcount, true)
|
||||
response[0].playcount, true)
|
||||
.addField('**Country:**',
|
||||
result[0].country, true)
|
||||
response[0].country, true)
|
||||
.addField('**Ranked Score:**',
|
||||
result[0].ranked_score, true)
|
||||
response[0].ranked_score, true)
|
||||
.addField('**Total Score:**',
|
||||
result[0].total_score, true)
|
||||
response[0].total_score, true)
|
||||
.addField('**SS:**',
|
||||
result[0].count_rank_ss, true)
|
||||
response[0].count_rank_ss, true)
|
||||
.addField('**S:**',
|
||||
result[0].count_rank_s, true)
|
||||
response[0].count_rank_s, true)
|
||||
.addField('**A:**',
|
||||
result[0].count_rank_a, true);
|
||||
response[0].count_rank_a, true);
|
||||
message.channel.sendEmbed(embed).catch(console.error);
|
||||
}
|
||||
}).catch(function (err) {
|
||||
message.channel.sendMessage(":x: Error! User not Found!");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
"hepburn": "^1.0.0",
|
||||
"imdb-api": "^2.2.1",
|
||||
"jimp": "^0.2.27",
|
||||
"osu": "^1.0.1",
|
||||
"pirate-speak": "^1.0.1",
|
||||
"request-promise": "^4.1.1",
|
||||
"urban": "^0.3.1",
|
||||
|
||||
Reference in New Issue
Block a user