refactor: move latest version logic
This commit is contained in:
parent
e1622eb545
commit
b5abe4e416
5 changed files with 30 additions and 30 deletions
|
@ -22,7 +22,7 @@ import { join } from 'path';
|
|||
|
||||
import { green, bold, blue, underline, yellow } from 'kleur/colors';
|
||||
import 'dotenv/config';
|
||||
import { getLatestMinecraft } from './utils/minecraftVersion';
|
||||
import { getLatestMinecraftVersion } from './utils/remoteVersions';
|
||||
|
||||
export interface Command {
|
||||
name: string;
|
||||
|
@ -79,7 +79,7 @@ client.once('ready', async () => {
|
|||
);
|
||||
|
||||
client.user?.presence.set({
|
||||
activities: [{ name: `Minecraft ${await getLatestMinecraft()}` }],
|
||||
activities: [{ name: `Minecraft ${await getLatestMinecraftVersion()}` }],
|
||||
status: 'online',
|
||||
});
|
||||
|
||||
|
@ -133,6 +133,7 @@ async function parseMsg(e: Message) {
|
|||
);
|
||||
|
||||
if (!cmd) {
|
||||
// TODO: Do not read tags.json everytime there is a new message
|
||||
const tag = await getTags().then((r) =>
|
||||
r.find(
|
||||
(t) => t.name == parsed.command || t.aliases?.includes(parsed.command)
|
||||
|
@ -142,12 +143,11 @@ async function parseMsg(e: Message) {
|
|||
if (tag) {
|
||||
if (tag.text) {
|
||||
e.reply(tag.text);
|
||||
return true;
|
||||
} else if (tag.embed) {
|
||||
const em = new MessageEmbed(tag.embed);
|
||||
e.reply({ embeds: [em] });
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue