Skip to content

Commit

Permalink
feat(qbox): recipes command
Browse files Browse the repository at this point in the history
  • Loading branch information
D4isDAVID committed Sep 19, 2024
1 parent 1482fec commit 820c9d3
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
55 changes: 55 additions & 0 deletions src/components/qbox/commands/recipes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import {
ApplicationCommandOptionType,
ApplicationCommandType,
} from '@discordjs/core';
import {
bold,
hideLinkEmbed,
hyperlink,
unorderedList,
userMention,
} from '@discordjs/formatters';
import { docsUrl } from '../constants.js';
import { ChatInputCommand } from '/components/types.js';
import { mapChatInputOptionValues } from '/utils/interactions.js';

function recipeUrl(recipe: string) {
return `https://raw.githubusercontent.com/Qbox-project/txAdminRecipe/main/${recipe}.yaml`;
}

export const recipesCommand = {
data: {
type: ApplicationCommandType.ChatInput,
name: 'recipes',
description: 'Send information about how Qbox recipes',
options: [
{
type: ApplicationCommandOptionType.Mentionable,
name: 'mention',
description: 'An optional user to mention',
},
],
},
async execute({ api, data: interaction }) {
const { mention } = mapChatInputOptionValues(interaction.data) as {
mention: string | undefined;
};

const content = [
bold(
'Qbox offers several different recipes for different use cases:',
),
unorderedList([
`${hyperlink('Qbox Unstable', hideLinkEmbed(recipeUrl('qbox')))} — a complete server base that comes with all of our actively maintained resources`,
`${hyperlink('Qbox Lean', hideLinkEmbed(recipeUrl('qbox')))} — a stripped down version of Qbox, without excess resources, and without criminal or civilian activities`,
`${hyperlink('Qbox Stable', hideLinkEmbed(recipeUrl('qbox')))} — comes with the resources we consider stable based on our ${hyperlink('Release Readiness', hideLinkEmbed(`${docsUrl}/release`))} guidelines`,
]),
`There may be caveats to using some of these recipes; learn more in our ${hyperlink('Installation', hideLinkEmbed(`${docsUrl}/installation`))} docs.`,
];
if (mention) content.unshift(userMention(mention));

await api.interactions.reply(interaction.id, interaction.token, {
content: content.join('\n'),
});
},
} satisfies ChatInputCommand;
2 changes: 2 additions & 0 deletions src/components/qbox/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { builtinCommand } from './commands/builtin.js';
import { compatCommand } from './commands/compat.js';
import { docsCommand } from './commands/docs.js';
import { onesyncCommand } from './commands/onesync.js';
import { recipesCommand } from './commands/recipes.js';
import { resourceCommand } from './commands/resource.js';
import { supportCommand } from './commands/support/chat-input-command.js';
import { supportMessageCommand } from './commands/support/message-command.js';
Expand All @@ -15,6 +16,7 @@ export default {
compatCommand,
docsCommand,
onesyncCommand,
recipesCommand,
resourceCommand,
supportCommand,
supportMessageCommand,
Expand Down

0 comments on commit 820c9d3

Please sign in to comment.