2025-09-17 13:33:10 -05:00
|
|
|
import {Guild, User} from "discord.js";
|
|
|
|
|
|
2025-09-18 11:43:47 -05:00
|
|
|
export async function replaceVars(text: string, user: User | undefined, guild: Guild | undefined, stats?: any): Promise<string> {
|
|
|
|
|
if(!text) return '';
|
2025-09-17 13:33:10 -05:00
|
|
|
|
|
|
|
|
return text
|
2025-09-18 11:43:47 -05:00
|
|
|
/**
|
|
|
|
|
* USER INFO
|
|
|
|
|
*/
|
|
|
|
|
.replace(/(user\.name)/g, user?.username ?? '')
|
|
|
|
|
.replace(/(user\.id)/g, user?.id ?? '')
|
|
|
|
|
.replace(/(user\.mention)/g, user ? `<@${user.id}>` : '')
|
|
|
|
|
.replace(/(user\.avatar)/g, user?.displayAvatarURL({ forceStatic: false }) ?? '')
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GUILD INFO
|
|
|
|
|
*/
|
|
|
|
|
.replace(/(guild\.name)/g, guild?.name ?? '')
|
|
|
|
|
.replace(/(guild\.icon)/g, guild?.iconURL({ forceStatic: false }) ?? '');
|
2025-09-17 13:33:10 -05:00
|
|
|
}
|