| 257 | |
| 258 | function generateRandomColor(): string { |
| 259 | return `#${Math.floor(Math.random() * 0xffffff).toString(16).padStart(6, "0")}`; |
| 260 | } |
| 261 | |
| 262 | function getCommandArgsText(msg: Api.Message, command: string): string { |
| 263 | const raw = ((msg as any).message || (msg as any).text || "") as string; |
| 264 | const prefix = getPrefixes().find((p) => raw.startsWith(p)) || raw[0] || ""; |
| 265 | const rest = raw.slice(prefix.length).trimStart(); |
| 266 | if (!rest) return ""; |
| 267 | const first = rest.split(/\s+/, 1)[0] || ""; |
| 268 | const normalized = first.replace(/@\w+$/i, ""); |
| 269 | if (normalized.toLowerCase() !== command.toLowerCase()) return rest; |
| 270 | return rest.slice(first.length).trimStart(); |
| 271 | } |