diff --git a/src/App.svelte b/src/App.svelte index 5186382..f5debb7 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -61,6 +61,8 @@ let oauthIdentity: 'streamer' | 'bot' = 'streamer'; let oauthBusy = false; let oauthError = ''; + let botCommands: Array<{ id: string; name: string; description: string; permission_level: string; aliases: string[]; tags: string[]; cooldown_seconds: number; cooldown_scope: string; response_template: string; error_template: string | null; enabled: boolean }> = []; + let botCommandError = ''; let oauthScopes: Record<'streamer' | 'bot', { connected: boolean; missing_scopes: string[]; reauthorization_required: boolean }> = { streamer: { connected: false, missing_scopes: [], reauthorization_required: false }, bot: { connected: false, missing_scopes: [], reauthorization_required: false }, @@ -113,6 +115,7 @@ await loadDiagnostics(); await loadOAuthStatus(); await loadCollaboration(); + await loadBotCommands(); await loadStreamInfo(); connectRealtime(); if (!mustReplaceCredentials) password = ''; @@ -515,6 +518,17 @@ } } + async function loadBotCommands() { + try { + const response = await fetch(`${serverAddress}/api/v1/bot/commands`); + if (!response.ok) throw new Error('Commands could not be loaded.'); + botCommands = await response.json(); + botCommandError = ''; + } catch (error) { + botCommandError = error instanceof Error ? error.message : 'Commands could not be loaded.'; + } + } + async function revokeOAuth(identity: 'streamer' | 'bot') { oauthBusy = true; oauthError = ''; @@ -627,6 +641,8 @@ {#if authError}