add charjs apis for bgembed (#324)
# PR Checklist - [x] Did you check if it works normally in all models? *ignore this when it dosen't uses models* - [x] Did you check if it works normally in all of web, local and node hosted versions? if it dosen't, did you blocked it in those versions? - [x] Did you added a type def? # Description It seems like someone is holding breath for this. 
This commit is contained in:
@@ -183,6 +183,25 @@ addWorkerFunction('setCharacterFirstMessage', async (data:string) => {
|
||||
return true
|
||||
})
|
||||
|
||||
addWorkerFunction('getBackgroundEmbedding', async () => {
|
||||
const db = get(DataBase)
|
||||
const selectedChar = get(selectedCharID)
|
||||
const char = db.characters[selectedChar]
|
||||
return char.backgroundHTML
|
||||
})
|
||||
|
||||
addWorkerFunction('setBackgroundEmbedding', async (data:string) => {
|
||||
const db = get(DataBase)
|
||||
const selectedChar = get(selectedCharID)
|
||||
if(typeof data !== 'string'){
|
||||
return false
|
||||
}
|
||||
db.characters[selectedChar].backgroundHTML = data
|
||||
setDatabase(db)
|
||||
return true
|
||||
})
|
||||
|
||||
|
||||
addWorkerFunction('getState', async (statename) => {
|
||||
const db = get(DataBase)
|
||||
const selectedChar = get(selectedCharID)
|
||||
|
||||
Reference in New Issue
Block a user