rizonrpg :⁾

This commit is contained in:
Flummi 2017-11-22 06:21:45 +01:00
parent 12a794f47f
commit 9c0767dc10
3 changed files with 42 additions and 0 deletions

19
package-lock.json generated
View File

@ -2143,6 +2143,11 @@
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz",
"integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg=="
}, },
"sax": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
"integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw=="
},
"semver": { "semver": {
"version": "5.4.1", "version": "5.4.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz",
@ -2348,6 +2353,20 @@
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
}, },
"xml2js": {
"version": "0.4.19",
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz",
"integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==",
"requires": {
"sax": "1.2.4",
"xmlbuilder": "9.0.4"
}
},
"xmlbuilder": {
"version": "9.0.4",
"resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.4.tgz",
"integrity": "sha1-UZy0ymhtAFqEINNJbz8MruzKWA8="
},
"youtube-dl": { "youtube-dl": {
"version": "1.12.2", "version": "1.12.2",
"resolved": "https://registry.npmjs.org/youtube-dl/-/youtube-dl-1.12.2.tgz", "resolved": "https://registry.npmjs.org/youtube-dl/-/youtube-dl-1.12.2.tgz",

View File

@ -16,6 +16,7 @@
"nodejs-mysql": "^0.1.3", "nodejs-mysql": "^0.1.3",
"request": "^2.83.0", "request": "^2.83.0",
"winston": "^2.4.0", "winston": "^2.4.0",
"xml2js": "^0.4.19",
"youtube-dl": "^1.12.2" "youtube-dl": "^1.12.2"
}, },
"devDependencies": { "devDependencies": {

View File

@ -1,4 +1,6 @@
import sql from "../sql.js"; import sql from "../sql.js";
const request = require("request")
, xmlparse = require('xml2js').parseString;
const data = { const data = {
abschieben: [], abschieben: [],
@ -346,4 +348,24 @@ module.exports = bot => {
} }
}); });
bot._trigger.set("rizonrpg", {
call: /^(.|\/)rizonrpg/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => {
let args = e.message.trim().split(" ");
args.shift();
args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0];
request(`http://idlerpg.rizon.net/xml.php?player=${args[0]}`, (err, res, body) => {
xmlparse(body, (err, body) => {
if(body.player.username.length === 0)
return e.reply(`player [b]${args[0]}[/b] was not found`);
e.reply(`[b]${body.player.username}[/b], the [b]${body.player.class}[/b]: level: ${body.player.level}, online: ${(body.player.online=="1").toString()}.`);
});
});
}
});
}; };