This commit is contained in:
Aslan 2026-01-20 19:54:45 -05:00
parent d36e98ad0b
commit c071b286af
23 changed files with 713 additions and 11 deletions

View file

@ -80,6 +80,18 @@ const getUserName = (user: IUser): string => {
return username;
};
const getUserNameById = (userId: string): string => {
const userPattern = /@[a-zA-Z0-9]*/;
const match = userId.match(userPattern)?.at(0);
if (!match) {
return "";
}
let username = match.replaceAll("@", "");
username = username.charAt(0).toUpperCase() + username.slice(1);
return username;
};
const getUserFromMention = (mention: string | undefined): IUser | undefined => {
if (!mention) {
return undefined;
@ -139,6 +151,7 @@ export {
checkRoles,
getLevel,
getUserName,
getUserNameById,
getUserFromMention,
changePersonality,
log,