mirror of
https://code.chipmunk.land/Parker2991/NitoriBot/
synced 2026-12-02 07:05:39 -05:00
get this command suggestion bullshit out of here its so god damn useless i wanna die in a ditch
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
const CommandSource = require('../util/command_source');
|
||||
module.exports = (context) => {
|
||||
let ratelimit = 0;
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const options = context.options;
|
||||
const { MessageBuilder } = require('prismarine-chat')(bot.options.version);
|
||||
bot.on("parsed_message", (data) => {
|
||||
if (data.type !== "minecraft:chat") return;
|
||||
const prefixes = config.prefixes;
|
||||
prefixes.map((prefix) => {
|
||||
const plainMessage = bot.getMessageAsPrismarine(data.contents)?.toString();
|
||||
if (!plainMessage.startsWith(prefix)) return
|
||||
const command = plainMessage.substring(prefix.length)
|
||||
const source = new CommandSource(data.sender, { discord: false, console: false }, true)
|
||||
ratelimit++
|
||||
setTimeout(() => {
|
||||
ratelimit--
|
||||
}, 1000)
|
||||
if (ratelimit > 2) { // new e.MessageBuilder().setText("e").toJSON()
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, new MessageBuilder().setText("You are using commands too fast!").setColor("dark_red").toJSON())
|
||||
// bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, { text: 'You are using commands too fast!', color: 'dark_red'})
|
||||
} else if (command.split(" ")[0].length === 0) {
|
||||
} else {
|
||||
bot.commandManager.executeString(source, command)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user