famous userOrNick

This commit is contained in:
Mylloon 2022-07-27 01:22:13 +02:00
parent b5016bb39b
commit a9c076247b
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -1,3 +1,5 @@
import { GuildMember } from 'discord.js';
/**
* Log module status.
* @param {string} name Module name
@ -58,3 +60,19 @@ export const isImage = (filename: string) => {
/jpg|jpeg|png|webp|gif/
));
};
/**
* String with pseudo and nickname if available.
* @param member Member
* @returns string
*/
export const userWithNickname = (member: GuildMember) => {
if (!member) {
return undefined;
}
if (member.nickname) {
return `${member.nickname} (${member.user.tag})`;
} else {
return member.user.tag;
}
};