blob: 6ffdc8f22dbf893194f4913b19024cd96e3b5970 [file] [log] [blame]
pineafan32767212022-03-14 21:27:39 +00001async function convertCurlyBracketString(str, memberID, memberName, serverName, members): Promise<string> {
2 let memberCount = (await members.fetch()).size
3 let bots = (await members.fetch()).filter(m => m.user.bot).size
4 str = str
pineafan02ba0232022-07-24 22:16:15 +01005 .replace("{member:mention}", memberID ? `<@${memberID}>` : "{member:mention}")
6 .replace("{member:name}", memberName ? `${memberName}` : "{member:name}")
7 .replace("{serverName}", serverName ? `${serverName}` : "{serverName}")
8 .replace("{memberCount}", memberCount ? `${memberCount}` : "{memberCount}")
9 .replace("{memberCount:bots}", bots ? `${bots}` : "{memberCount:bots}")
10 .replace("{memberCount:humans}", (memberCount && bots) ? `${memberCount - bots}` : "{memberCount:humans}");
pineafan32767212022-03-14 21:27:39 +000011
12 return str
13}
14
pineafanc6158ab2022-06-17 16:34:07 +010015export default convertCurlyBracketString;