add better aniv timeouts, add aniv dodges, fix blank user target bug

This commit is contained in:
2025-10-09 17:30:48 +02:00
parent bdc7b4a171
commit e46cec80ed
7 changed files with 72 additions and 17 deletions

View File

@@ -0,0 +1,19 @@
import { Command, sendMessage } from "commands";
import { getAnivTimeouts } from "db/dbAnivTimeouts";
import parseCommandArgs from "lib/parseCommandArgs";
import User from "user";
export default new Command({
name: 'anivtimeouts',
aliases: ['anivtimeouts', 'anivtimeout'],
usertype: 'chatter',
execution: async (msg, user) => {
const args = parseCommandArgs(msg.messageText);
const target = args[0] ? await User.initUsername(args[0].toLowerCase()) : user;
if (!target) { await sendMessage(`Chatter ${args[0]} doesn't exist!`, msg.messageId); return; };
const { dodge, dead } = await getAnivTimeouts(target);
const percentage = ((dodge / (dead + dodge)) * 100);
const message = `Aniv timeouts of ${target.displayName}: Dodge: ${dodge}, Timeout: ${dead}. Dodge percentage: ${isNaN(percentage) ? "0" : percentage.toFixed(1)}%`;
await sendMessage(message, msg.messageId);
}
});