twitch_bot/commands/pyramid.js

34 lines
885 B
JavaScript
Raw Normal View History

2023-02-01 12:04:14 +01:00
const command = {
name: "pyramid",
desc: "make a pyramid (this blocks the thread and no other command will execute until it's done)",
2023-02-02 23:37:42 +01:00
restricted: true,
2023-02-02 23:58:58 +01:00
mod: true,
2023-02-01 12:04:14 +01:00
run: async (client, msg, splitted) => {
if (
isNaN(splitted[2]) ||
splitted[2] === undefined ||
splitted[3] === undefined ||
parseInt(splitted[2]) > 50
) {
2023-02-11 13:48:05 +01:00
await client.say(
2023-02-01 12:04:14 +01:00
msg.channelName,
`${msg.displayName}, Second arg needs to be a valid number and third arg needs to exist PoroSad`
);
return;
2023-02-01 12:04:14 +01:00
}
let arr = [];
for (let i = 0; i < parseInt(splitted[2]); i++) {
arr.push(splitted.slice(3).join(" "));
2023-02-11 13:48:05 +01:00
client.say(msg.channelName, arr.join(" "));
2023-02-01 12:04:14 +01:00
}
for (let i = parseInt(splitted[2]); i > 1; i--) {
arr.pop();
2023-02-11 13:48:05 +01:00
client.say(msg.channelName, arr.join(" "));
2023-02-01 12:04:14 +01:00
}
},
};
2023-02-01 22:11:48 +01:00
module.exports = { command };