MCPcopy Index your code
hub / github.com/codebymitch/TitanBot / formatChannelName

Function formatChannelName

src/utils/database.js:1526–1545  ·  view source on GitHub ↗
(template, variables)

Source from the content-addressed store, hash-verified

1524}
1525
1526export 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();
1542formatted = formatted.substring(0, 100);
1543
1544 return formatted || 'Voice Channel';
1545}
1546
1547function generateCaseId() {
1548 return `${Date.now().toString(36)}-${Math.random().toString(36).substr(2, 4)}`;

Callers 2

createTemporaryChannelFunction · 0.90
transferChannelOwnershipFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected