mirror of https://github.com/clickscodes/nucleus
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
587 B
22 lines
587 B
import emojis from '../config/emojis.json' assert {type: 'json'};
|
|
|
|
function getEmojiByName(name: string, format?: string): string {
|
|
let split = name.split(".");
|
|
let id = emojis
|
|
split.forEach(part => {
|
|
id = id[part];
|
|
});
|
|
if ( format === "id" ) {
|
|
if (id === undefined) return "0";
|
|
return id.toString();
|
|
}
|
|
if (id === undefined) {
|
|
return `<a:a:946346549271732234>`
|
|
} else if (id.toString().startsWith("a")) {
|
|
return `<a:a:${id.toString().slice(0, -1)}>`
|
|
}
|
|
return `<:a:${id}>`;
|
|
}
|
|
|
|
export default getEmojiByName;
|