Skip to content

Commit

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

export const onesyncCommand = {
data: {
type: ApplicationCommandType.ChatInput,
name: 'onesync',
description: 'Send information about how to enable OneSync infinity',
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 requires ${hyperlink('OneSync: Infinity', 'https://docs.fivem.net/docs/scripting-reference/onesync/')} to work correctly.`,
),
'After completing the steps provided below, the next server start should have it enabled.',
'',
bold('With txAdmin:'),
orderedList([
'Go to the `Settings` page,',
'Go to the `FXServer` section,',
'Set the `OneSync` option to `On (with infinity)`,',
'Click on `Save FXServer Settings`.',
]),
'',
bold('Without txAdmin:'),
unorderedList([
'Pass `+set onesync on` to `FXServer.exe` on Windows or `run.sh` on Linux.',
]),
];
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 @@ -3,6 +3,7 @@ import { aboutCommand } from './commands/about.js';
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 { resourceCommand } from './commands/resource.js';
import { supportCommand } from './commands/support/chat-input-command.js';
import { supportMessageCommand } from './commands/support/message-command.js';
Expand All @@ -13,6 +14,7 @@ export default {
builtinCommand,
compatCommand,
docsCommand,
onesyncCommand,
resourceCommand,
supportCommand,
supportMessageCommand,
Expand Down

0 comments on commit f09dfcb

Please sign in to comment.