(template, variables)
| 1524 | } |
| 1525 | |
| 1526 | export function formatChannelName(template, variables) { |
| 1527 | let formatted = template; |
| 1528 | |
| 1529 | const replacements = { |
| 1530 | '{username}': variables.username || 'User', |
| 1531 | '{user_tag}': variables.userTag || 'User#0000', |
| 1532 | '{display_name}': variables.displayName || 'User', |
| 1533 | '{guild_name}': variables.guildName || 'Server', |
| 1534 | '{channel_name}': variables.channelName || 'Voice Channel' |
| 1535 | }; |
| 1536 | |
| 1537 | for (const [placeholder, value] of Object.entries(replacements)) { |
| 1538 | formatted = formatted.replace(new RegExp(placeholder.replace(/[{}]/g, '\\$&'), 'g'), value); |
| 1539 | } |
| 1540 | |
| 1541 | formatted = formatted.replace(/[^\w\s-]/g, '').trim(); |
| 1542 | formatted = formatted.substring(0, 100); |
| 1543 | |
| 1544 | return formatted || 'Voice Channel'; |
| 1545 | } |
| 1546 | |
| 1547 | function generateCaseId() { |
| 1548 | return `${Date.now().toString(36)}-${Math.random().toString(36).substr(2, 4)}`; |
no outgoing calls
no test coverage detected