Elimino los embedBuilder y los cambio por Components Message V2, algo tardado.
This commit is contained in:
@@ -1,12 +1,20 @@
|
||||
import {Guild, User} from "discord.js";
|
||||
|
||||
export async function replaceVars(text: string, user: User | undefined, guild:
|
||||
Guild | undefined, stats: any) {
|
||||
if(!text) return;
|
||||
export async function replaceVars(text: string, user: User | undefined, guild: Guild | undefined, stats?: any): Promise<string> {
|
||||
if(!text) return '';
|
||||
|
||||
return text
|
||||
.replace(/(user.name)/g, user!.username ?? '')
|
||||
.replace(/(user.id)/g, user!.id ?? '')
|
||||
.replace(/(user.mention)/g, `<@${user!.id}>`)
|
||||
.replace(/(user.avatar)/g, user!.displayAvatarURL({ forceStatic: false }))
|
||||
/**
|
||||
* 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 }) ?? '');
|
||||
}
|
||||
Reference in New Issue
Block a user