feat(aiscript): Better env vars

This commit is contained in:
syuilo 2020-04-19 16:28:19 +09:00
parent e60048eb96
commit 0a1b83c70f
1 changed files with 3 additions and 2 deletions

View File

@ -3,8 +3,9 @@ import { utils, values } from '@syuilo/aiscript';
export function createAiScriptEnv(vm, opts) { export function createAiScriptEnv(vm, opts) {
let apiRequests = 0; let apiRequests = 0;
return { return {
USER_ID: values.STR(vm.$store.state.i.id), USER_ID: vm.$store.getters.isSignedIn ? values.STR(vm.$store.state.i.id) : values.NULL,
USER_USERNAME: values.STR(vm.$store.state.i.username), 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]) => { 'Mk:dialog': values.FN_NATIVE(async ([title, text, type]) => {
await vm.$root.dialog({ await vm.$root.dialog({
type: type ? type.value : 'info', type: type ? type.value : 'info',