import type { SlashCommandHandler } from './types' import React from 'react' import { RiDiscordLine } from '@remixicon/react' import i18n from '@/i18n-config/i18next-config' import { registerCommands, unregisterCommands } from './command-bus' // Community command dependency types type CommunityDeps = Record /** * Community command - Opens Discord community */ export const communityCommand: SlashCommandHandler = { name: 'community', description: 'Open community Discord', async search(args: string, locale: string = 'en') { return [{ id: 'community', title: i18n.t('common.userProfile.community', { lng: locale }), description: i18n.t('app.gotoAnything.actions.communityDesc', { lng: locale }) || 'Open Discord community', type: 'command' as const, icon: (
), data: { command: 'navigation.community', args: { url: 'https://discord.gg/5AEfbxcd9k' } }, }] }, register(_deps: CommunityDeps) { registerCommands({ 'navigation.community': async (args) => { const url = args?.url || 'https://discord.gg/5AEfbxcd9k' window.open(url, '_blank', 'noopener,noreferrer') }, }) }, unregister() { unregisterCommands(['navigation.community']) }, }