args the second

This commit is contained in:
Flummi 2017-11-27 03:44:02 +01:00
parent bda1fbdb7a
commit 15071714cb
2 changed files with 6 additions and 11 deletions

View File

@ -18,8 +18,7 @@ module.exports = bot => {
bot._trigger.set("coins", new bot.trigger({ bot._trigger.set("coins", new bot.trigger({
call: /^(\.|\/)(btc|eth|xmr)/i, call: /^(\.|\/)(btc|eth|xmr)/i,
f: e => { f: e => {
let args = e.message.trim().substr(1).toLowerCase().split(" "); cryptowat_summary(e.cmd, markets[e.cmd], e.cmd !== "xmr" ? e.args[0] || "usd" : "usd").then(
cryptowat_summary(args[0], markets[args[0]], args[0] !== "xmr" ? args[1] : "usd").then(
resolve => e.reply(resolve), resolve => e.reply(resolve),
reject => e.reply(reject) reject => e.reply(reject)
); );
@ -47,7 +46,6 @@ const cryptowat_summary = (crypto, market, currency) => {
change: (result.price.change.percentage * 100).toFixed(2), change: (result.price.change.percentage * 100).toFixed(2),
volume: result.volume volume: result.volume
}; };
resolve(`Current: [b]${data.last}[/b] - High: [b]${data.high}[/b] - Low: [b]${data.low}[/b] - Change: [b]${data.change}[/b]% - Volume: [b]${data.volume}[/b]`); resolve(`Current: [b]${data.last}[/b] - High: [b]${data.high}[/b] - Low: [b]${data.low}[/b] - Change: [b]${data.change}[/b]% - Volume: [b]${data.volume}[/b]`);
}); });
}); });

View File

@ -7,8 +7,7 @@ module.exports = bot => {
level: 100, level: 100,
clients: ["irc"], clients: ["irc"],
f: e => { f: e => {
let args = e.message.trim().substring(6).split(" "); const chans = e.args.filter(chan => chan.charAt(0) === "#");
let chans = args.filter(chan => chan.charAt(0) === "#");
chans.map(e.join); chans.map(e.join);
e.reply(`joined channel${chans.length > 1 ? "s" : null}: ${chans.join(", ")}`); e.reply(`joined channel${chans.length > 1 ? "s" : null}: ${chans.join(", ")}`);
} }
@ -19,8 +18,7 @@ module.exports = bot => {
level: 100, level: 100,
clients: ["irc"], clients: ["irc"],
f: e => { f: e => {
let args = e.message.trim().substring(6).split(" "); const chans = e.args.filter(chan => chan.charAt(0) === "#");
let chans = args.filter(chan => chan.charAt(0) === "#");
chans.map(e.part); chans.map(e.part);
e.reply(`parted channel${chans.length > 1 ? "s" : null}: ${chans.join(", ")}`); e.reply(`parted channel${chans.length > 1 ? "s" : null}: ${chans.join(", ")}`);
} }
@ -31,11 +29,10 @@ module.exports = bot => {
level: 100, level: 100,
clients: ["irc"], clients: ["irc"],
f: e => { f: e => {
let args = e.message.trim().substring(6).split(" "); e.write(`NICK ${e.args[0]}`);
e.write(`NICK ${args[0]}`);
e._user.deli(e.self.me.nickname); e._user.deli(e.self.me.nickname);
e.whois(args[0]); e.whois(e.args[0]);
e.reply(`changed nick to ${args[0]}`); e.reply(`changed nick to ${e.args[0]}`);
} }
})); }));