/[sudobot]/branches/2.x/src/utils/Emoji.ts
ViewVC logotype

Contents of /branches/2.x/src/utils/Emoji.ts

Parent Directory Parent Directory | Revision Log Revision Log


Revision 577 - (show annotations)
Mon Jul 29 18:52:37 2024 UTC (8 months ago) by rakinar2
File MIME type: application/typescript
File size: 666 byte(s)
chore: add old version archive branches (2.x to 9.x-dev)
1 import { Emoji } from "discord.js";
2 import DiscordClient from "../client/Client";
3
4 function globalConfig() {
5 return DiscordClient.client.config.props.global;
6 }
7
8 export async function fetchEmoji(name: string) {
9 return await findEmoji(e => e.name === name);
10 }
11
12 export async function fetchEmojiStr(name: string) {
13 return (await findEmoji(e => e.name === name))?.toString();
14 }
15
16 export function emoji(name: string) {
17 return findEmoji(e => e.name === name)?.toString();
18 }
19
20 export function findEmoji(callback: (e: Emoji) => boolean) {
21 return DiscordClient.client.guilds.cache.find(g => g.id === globalConfig().id)!.emojis.cache.find(callback);
22 }

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26