refactor(tags): pull embed options to top level and adopt embed images

This commit is contained in:
Ryan Cao 2023-05-14 17:49:51 +08:00
parent 845f79fe9b
commit 8e279ae5cf
No known key found for this signature in database
18 changed files with 78 additions and 102 deletions

View file

@ -24,17 +24,15 @@ export const tagsCommand = async (
return;
}
const embed = new EmbedBuilder();
embed.setTitle(tag.title ?? tag.name);
embed.setDescription(tag.content);
if (tag.color) embed.setColor(tag.color);
if (tag.image) embed.setImage(tag.image);
if (tag.fields) embed.setFields(tag.fields);
await i.reply({
content:
(mention ? `<@${mention.id}> ` : '') +
(tag.text ? `**${tag.name}**\n\n` + tag.text : ''),
embeds: tag.embed
? [
new EmbedBuilder(tag.embed).setFooter({
text: `Requested by ${i.user.tag}`,
iconURL: i.user.avatarURL() ?? undefined,
}),
]
: [],
content: mention ? `<@${mention.id}> ` : undefined,
embeds: [embed],
});
};

View file

@ -1,15 +1,18 @@
import type { EmbedData } from 'discord.js';
import matter from 'gray-matter';
import { readdir, readFile } from 'fs/promises';
import { join } from 'path';
import { COLORS } from './constants';
import { type EmbedField } from 'discord.js';
interface Tag {
name: string;
aliases?: string[];
text?: string;
embed?: EmbedData;
title?: string;
color?: number;
content: string;
image?: string;
fields?: EmbedField[];
}
const TAG_DIR = join(process.cwd(), 'tags');
@ -22,23 +25,12 @@ export const getTags = async (): Promise<Tag[]> => {
const file = join(TAG_DIR, _file);
const { data, content } = matter(await readFile(file));
if (data.embed) {
tags.push({
...data,
name: _file.replace('.md', ''),
embed: {
...data.embed,
description: content.trim(),
color: COLORS[data.embed.color],
},
content: content.trim(),
color: data.color ? COLORS[data.color] : undefined,
});
} else {
tags.push({
...data,
name: _file.replace('.md', ''),
text: content.trim(),
});
}
}
return tags;

View file

@ -1,8 +1,7 @@
---
title: Binary Search - A method of finding problems with mods
color: blue
aliases: ['thanosmethod']
embed:
title: Binary Search - A method of finding problems with mods
color: blue
---
The binary search is a way of finding a faulty thing amongst a lot of other things, without having to remove the things one-by-one. This is useful for finding a broken mod among hundreds of mods, without having to spend time testing the mods one-by-one.

View file

@ -1,7 +1,6 @@
---
embed:
title: Building Prism from scratch
color: blue
title: Building Prism from scratch
color: blue
---
https://prismlauncher.org/wiki/development/build-instructions/

View file

@ -1,8 +1,7 @@
---
title: What's wrong with CurseForge?
color: orange
aliases: ['cf', 'curse', 'cursed', 'cursedfrog']
embed:
title: What's wrong with CurseForge?
color: orange
---
CurseForge added a new option to block third party clients like Prism Launcher from accessing mod files, and they started to enforce this option lately. We can't allow you to download those mods directly from CurseForge because of this. However, Prism Launcher offers a workaround to enable the downloading of these mods, by allowing you to download these mods from your browser and automatically importing them into the instance. We highly encourage asking authors that opted out of client downloads to stop doing so.

View file

@ -1,6 +1,6 @@
---
embed:
title: Java Instructions
color: orange
title: Java Instructions
color: orange
---
Currently, Prism Launcher does not bundle Java with itself. The instructions to setup and install Java can be found [here](https://prismlauncher.org/wiki/getting-started/installing-java/).

View file

@ -1,13 +1,11 @@
---
title: Forge Bugfix
color: yellow
aliases: ['javaforgebug', 'forgebug', 'forgejavabugfix', 'forgejavabug']
embed:
title: Forge Bugfix
color: yellow
image: https://media.discordapp.net/attachments/1040383700845740072/1057840239751729172/Fix.png
---
1. Click the instance that is broken, then select `Edit`.
2. Choose `Version` and then click `Forge`, then click the change version button.
3. You can then change the version, choose the latest, and click OK.
4. You are good to go! <a:minecraftpartyparrotr:1032312401577652274>
https://media.discordapp.net/attachments/1040383700845740072/1057840239751729172/Fix.png

View file

@ -1,8 +1,6 @@
---
aliases: ['legacyjava', 'ljf']
embed:
title: LegacyJavaFixer
color: yellow
title: LegacyJavaFixer
color: yellow
---
MinecraftForge provides a coremod to fix some issues with older Forge versions on recent Java versions. You can download it [here](https://dist.creeper.host/FTB2/maven/net/minecraftforge/lex/legacyjavafixer/1.0/legacyjavafixer-1.0.jar).

View file

@ -1,9 +1,8 @@
---
title: Upload Logs
color: orange
aliases: ['sendlog', 'logs', '🪵']
embed:
title: Upload Logs
color: orange
image: https://media.discordapp.net/attachments/923671549758820434/1027408644289077268/unknown.png
---
Please send logs! The recommended site to upload your logs to is [mclo.gs](https://mclo.gs/).
https://media.discordapp.net/attachments/923671549758820434/1027408644289077268/unknown.png
Please send logs! The recommended site to upload your logs to is [mclo.gs](https://mclo.gs/).

View file

@ -1,8 +1,7 @@
---
title: Migrating from MultiMC
color: orange
aliases: ['migr', 'mmc', 'multimc']
embed:
title: Migrating from MultiMC
color: orange
---
https://prismlauncher.org/wiki/getting-started/migrating-multimc/

View file

@ -1,8 +1,7 @@
---
title: OptiFine
color: green
aliases: ['of', 'optimize', 'opticrap', 'notfine']
embed:
title: OptiFine
color: green
---
OptiFine is known to cause problems when paired with other mods.

View file

@ -1,9 +1,9 @@
---
title: Data directories
color: blue
aliases: ['dirs', 'locate']
embed:
title: Data directories
color: blue
fields:
fields:
- name: Portable (Windows / Linux)
value: In the PrismLauncher folder
- name: Windows

View file

@ -1,7 +1,6 @@
---
embed:
title: We don't tolerate piracy!
color: red
title: We don't tolerate piracy!
color: red
---
Prism Launcher has always been legal, legitimate & appropriate. We don't and never will have features such as offline login without an official account.

View file

@ -1,8 +1,7 @@
---
title: Why PluralKit?
color: blue
aliases: ['pk']
embed:
title: Why PluralKit?
color: blue
---
Plurality is the existence of multiple self-aware entities inside the same brain.

View file

@ -1,9 +1,9 @@
---
title: Does Prism Launcher auto-update?
color: blue
aliases: ['updating', 'autoupdate']
embed:
title: Does Prism Launcher auto-update?
color: blue
---
Windows auto-updating is WIP. For now, you will need to download the installer and run it again in order to update. You will not lose your instances.
Prism Launcher auto-updates for macOS using the [Sparkle Framework](https://sparkle-project.org/).

View file

@ -1,8 +1,7 @@
---
title: vcredist is required for Prism to run Windows
color: pink
aliases: ['msvc']
embed:
title: vcredist is required for Prism to run Windows
color: pink
---
Like most apps on Windows, you have to install vcredist for Prism to run. Depending on what version of Prism you are using, you may need a different version.

View file

@ -1,13 +1,12 @@
---
title: But why?
color: purple
aliases:
- 'whywasprismlaunchermade'
- 'whywasprismmade'
- 'whywaspolymcmade'
- 'mmcdrama'
- 'devlauncher'
embed:
title: But why?
color: purple
---
https://prismlauncher.org/wiki/overview/faq/#why-did-our-community-choose-to-fork

View file

@ -1,9 +1,9 @@
---
title: Why does Prism Launcher ask me to change Java version?
color: orange
aliases: ['isjava8ancient', 'whyisprismforcingme']
embed:
title: Why does Prism Launcher ask me to change Java version?
color: orange
---
Minecraft versions before 1.17 required Java 8 and have issues with newer Java, while newer versions require Java 17, so you need to change Java version. Some people think Java 8 is very outdated, however, it's actually an LTS, meaning it's still getting updates.
If one of your mods is weird and requires newer Java, you can bypass this, by going to instance settings-Java and ticking 'Skip java compatibility checks', but be aware of potential issues, such as [random CMEs](https://bugs.mojang.com/browse/MC-149777).