MCPcopy
hub / github.com/codebymitch/TitanBot / formatCooldownDuration

Function formatCooldownDuration

src/utils/abuseProtection.js:110–128  ·  view source on GitHub ↗
(ms)

Source from the content-addressed store, hash-verified

108}
109
110export function formatCooldownDuration(ms) {
111 if (!Number.isFinite(ms) || ms <= 0) {
112 return 'a moment';
113 }
114
115 const totalSeconds = Math.ceil(ms / 1000);
116 const minutes = Math.floor(totalSeconds / 60);
117 const seconds = totalSeconds % 60;
118
119 if (minutes > 0 && seconds > 0) {
120 return `${minutes}m ${seconds}s`;
121 }
122
123 if (minutes > 0) {
124 return `${minutes}m`;
125 }
126
127 return `${seconds}s`;
128}
129
130export function isRiskyCommand(command, commandName) {
131 const protectionEnabled = command?.abuseProtection?.enabled;

Callers 3

handlePrefixCommandFunction · 0.90
executeFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected