famous userOrNick
This commit is contained in:
parent
b5016bb39b
commit
a9c076247b
1 changed files with 18 additions and 0 deletions
|
@ -1,3 +1,5 @@
|
||||||
|
import { GuildMember } from 'discord.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Log module status.
|
* Log module status.
|
||||||
* @param {string} name Module name
|
* @param {string} name Module name
|
||||||
|
@ -58,3 +60,19 @@ export const isImage = (filename: string) => {
|
||||||
/jpg|jpeg|png|webp|gif/
|
/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;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
Loading…
Reference in a new issue