From 0a1b83c70fc546d7514176a220e1381ecc0b13ec Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 19 Apr 2020 16:28:19 +0900 Subject: [PATCH] feat(aiscript): Better env vars --- src/client/scripts/create-aiscript-env.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/client/scripts/create-aiscript-env.ts b/src/client/scripts/create-aiscript-env.ts index 5a492c64dd..863cfadb8d 100644 --- a/src/client/scripts/create-aiscript-env.ts +++ b/src/client/scripts/create-aiscript-env.ts @@ -3,8 +3,9 @@ import { utils, values } from '@syuilo/aiscript'; export function createAiScriptEnv(vm, opts) { let apiRequests = 0; return { - USER_ID: values.STR(vm.$store.state.i.id), - USER_USERNAME: values.STR(vm.$store.state.i.username), + USER_ID: vm.$store.getters.isSignedIn ? values.STR(vm.$store.state.i.id) : values.NULL, + USER_NAME: vm.$store.getters.isSignedIn ? values.STR(vm.$store.state.i.name) : values.NULL, + USER_USERNAME: vm.$store.getters.isSignedIn ? values.STR(vm.$store.state.i.username) : values.NULL, 'Mk:dialog': values.FN_NATIVE(async ([title, text, type]) => { await vm.$root.dialog({ type: type ? type.value : 'info',