Skip to content

Commit

Permalink
type the boop
Browse files Browse the repository at this point in the history
  • Loading branch information
meadowsys committed Nov 20, 2023
1 parent 48ea1dd commit e753449
Showing 1 changed file with 37 additions and 7 deletions.
44 changes: 37 additions & 7 deletions modules/Boop/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ module.exports = class Boop extends Module {
*/
megaBoop(msg, user, type, commit) {
let random;
/** @type { number } */
let damage;
/** @type { string | Array<string> } */
let answer = "";
Expand Down Expand Up @@ -279,10 +280,22 @@ module.exports = class Boop extends Module {
this.counterWindow(delay + init_delay);
setTimeout(() => {
if (Array.isArray(answer)) {
Tools.listSender(msg.channel, answer, [delay, 2000, 1000], [user, damage], this.interrupt)
Tools
.listSender(
msg.channel,
answer,
[delay, 2000, 1000],
[user.toString(), damage.toString()],
this.interrupt
)
.then(commit)
} else {
msg.channel.send(Tools.parseReply(answer, user.toString(), damage))
msg.channel
.send(Tools.parseReply(
answer,
user.toString(),
damage.toString()
))
.then(commit);
}
}, init_delay);
Expand Down Expand Up @@ -314,7 +327,12 @@ module.exports = class Boop extends Module {
const random = Tools.getRandomIntFromInterval(0, this.config.hyperBoopAnswer.length - 1);
const ans = this.config.hyperBoopAnswer[random];
if (Array.isArray(ans)) {
Tools.listSender(msg.channel, ans, [1000, 2000, 4000, 4000, 2000, 2000, 2000, 2000, 3000], [user]);
Tools.listSender(
msg.channel,
ans,
[1000, 2000, 4000, 4000, 2000, 2000, 2000, 2000, 3000],
[user.toString()]
);
} else {
msg.channel.send(Tools.parseReply(ans, user.toString()))
.then(commit);
Expand Down Expand Up @@ -357,9 +375,9 @@ module.exports = class Boop extends Module {
const delay2 = 2000;
const config = this.config;
if (Array.isArray(ans)) {
Tools.listSender(msg.channel, ans, delay, [user]).then(() => {
Tools.listSender(msg.channel, ans, delay, [user.toString()]).then(() => {
setTimeout(function() {
msg.channel.send(Tools.parseReply(config.dev_ultra_boop_impact, [user]), { files:[path] }).then(function() {
msg.channel.send(Tools.parseReply(config.dev_ultra_boop_impact, user.toString()), { files: [path] }).then(function() {
boop_dev_on = true;
msg.channel.send(Tools.parseReply(config.dev_ultra_boop_postimpact));
});
Expand All @@ -373,10 +391,15 @@ module.exports = class Boop extends Module {
Application.modules.Discord.setMessageSent();
}


/**
* @param { import("discord.js").Message } msg
* @param { string } type_pre
*/
counter(msg, type_pre) {
this.interrupt.inter = true;
/** @type { Array<string> } */
let ans;
/** @type { string | number } */
let type;
if (type_pre === "Block") {
ans = this.config.megaBoopBlock;
Expand All @@ -387,18 +410,25 @@ module.exports = class Boop extends Module {
type = type_pre;
}
setTimeout(function() {
Tools.listSender(msg.channel, ans, [2000], [msg.author, type]);
Tools.listSender(msg.channel, ans, [2000], [msg.author.toString(), type.toString()]);
}.bind(this), 2000);
Application.modules.Discord.setMessageSent();
}

/**
* @param { number } time
*/
counterWindow(time) {
this.megaon = true;
setTimeout(function() {
this.megaon = false;
}.bind(this), time);
}

/**
* @param { Array<string> } ans
* @param { number } limit
*/
statusgenerator(ans, limit, miss = false) {
let res = [];

Expand Down

0 comments on commit e753449

Please sign in to comment.