alias :⁾

This commit is contained in:
Flummi 2018-09-11 18:01:42 +02:00
parent 934f3a8918
commit 3f46d69b39

View File

@ -9,7 +9,8 @@ export default bot => {
.then(res => res.text())
.then(res => {
e.args[0] = e.args[0] || e.user.nick;
let players = new Map();
let players = new Map()
, alias = {};
res
.split("\n").join``
.match(/\<tr\>(.*?)\<\/tr\>/gsi)
@ -20,15 +21,22 @@ export default bot => {
.replace("</td>", "")
):false)
.splice(1)
.forEach(p => players.set(p[1].toLowerCase(), {
.forEach(p => { // 6 archangel!archangel@pomf.space
const nick = p[6].split("!")[0].toLowerCase();
players.set(p[1].toLowerCase(), {
rang: parseInt(p[0]),
name: p[1],
level: parseInt(p[2]),
class: p[4],
ttl: p[5],
online: p[7] === "Yes",
nick: nick,
itemsum: parseInt(p[31])
}));
});
if(nick !== p[1].toLowerCase())
alias[nick] = p[1].toLowerCase();
});
e.args[0] = (e.args[0].toLowerCase() in alias)?alias[e.args[0].toLowerCase()]:e.args[0];
let p = players.has(e.args[0].toLowerCase())?players.get(e.args[0].toLowerCase()):false;
let tmp = e.args[0].match(/#\d+/);
if(tmp) {