Fixed bug in summon
This commit is contained in:
parent
ed6615c238
commit
9ef31d201f
2
bot.js
2
bot.js
|
@ -167,7 +167,7 @@ const castSpell = (client, from, to, incantation) => {
|
|||
if (splitIncantation[1]) {
|
||||
const variable = splitIncantation[1].trim().split(" ");
|
||||
spell.incantation = incantation.split(splitIncantation[1])[0];
|
||||
response = spell.test.apply(spell, variable.splice(0, vars));
|
||||
response = spell.test.apply(spell, variable);
|
||||
} else {
|
||||
response = spell.test();
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ module.exports = class Summon {
|
|||
return { say: false };
|
||||
}
|
||||
|
||||
cast(user, reason) {
|
||||
cast(user, ...reason) {
|
||||
let response = {
|
||||
say: false,
|
||||
debug: {},
|
||||
|
@ -47,6 +47,8 @@ module.exports = class Summon {
|
|||
|
||||
if (!reason) {
|
||||
reason = "<none>";
|
||||
} else {
|
||||
reason = reason.join(" ");
|
||||
}
|
||||
|
||||
const subject = "You have been summoned!";
|
||||
|
@ -75,9 +77,11 @@ module.exports = class Summon {
|
|||
// I obvious don't know everyone's Pushbullet API
|
||||
if (user === this.client.config.author) {
|
||||
const self = this;
|
||||
let sent = false;
|
||||
self.pusher.devices().then(function (res) {
|
||||
const devices = res.devices;
|
||||
devices.forEach((device) => {
|
||||
if (sent) return false;
|
||||
if (device.nickname === self.client.config.device) {
|
||||
const iden = device.iden;
|
||||
self.pusher.note(iden, subject, text, (err, info) => {
|
||||
|
@ -85,6 +89,7 @@ module.exports = class Summon {
|
|||
// console.log("Summon::pusher", info);
|
||||
response.debug.pusher = info;
|
||||
});
|
||||
sent = true;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue