https://github.com/magicoflolis/aidungeon.js
Edit AI Dungeon scenarios in your favorite editor and upload changes.
https://github.com/magicoflolis/aidungeon.js
ai aidungeon dungeon npm-package
Last synced: 11 months ago
JSON representation
Edit AI Dungeon scenarios in your favorite editor and upload changes.
- Host: GitHub
- URL: https://github.com/magicoflolis/aidungeon.js
- Owner: magicoflolis
- License: mit
- Created: 2025-05-29T21:27:10.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-21T15:33:09.000Z (12 months ago)
- Last Synced: 2025-06-27T00:50:04.921Z (12 months ago)
- Topics: ai, aidungeon, dungeon, npm-package
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/aidungeon.js
- Size: 51.8 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# aidungeon.js
Edit AI Dungeon scenarios in your favorite editor and upload changes.
## **Features**
- Build + minimize scenario scripts to local disk, default folder `./dist`.
- Update *multiple* scenarios.
- Supports common AI Dungeon GraphQL queries.
- Supports custom GraphQL queries.
## Pre-requirements
- [Node.js](https://nodejs.org/) + basic understanding of Node.JS and `package.json` workspaces
- Access to your [Firebase token](#getting-your-firebase-token)
## **Install**
**npm:**
```bash
npm install aidungeon.js
```
**pnpm:**
```bash
pnpm add aidungeon.js
```
### Getting Your Firebase Token
> Tokens will expire after `x` amount of time
**DevTools (recommended):**
- Open your web browsers DevTools, `Ctrl` + `Shift` + `I`
- Navigate to the `console` tab
- Copy n paste the code below into the console and hit `Enter`
- The console will print: `AID_TOKEN="Your Token"`
- Repeat steps to refresh your token
```js filename="tests/browser.js"
(async () => {
return new Promise((resolve, reject) => {
if (typeof indexedDB !== 'undefined') {
const dbReq = indexedDB.open('firebaseLocalStorageDb');
dbReq.onerror = reject;
dbReq.onsuccess = (event) => {
const transaction = event.target.result.transaction(['firebaseLocalStorage'], 'readwrite');
const objectStore = transaction.objectStore('firebaseLocalStorage');
const allKeys = objectStore.getAllKeys();
allKeys.onerror = reject;
allKeys.onsuccess = (evt) => {
const key = evt.target.result.find((r) => r.includes('firebase:authUser:'));
objectStore.get(key).onsuccess = (evt) => {
const { value } = evt.target.result;
resolve(`AID_TOKEN="${value.stsTokenManager.accessToken}"`);
};
};
};
} else {
reject(new Error('indexedDB is not defined.'));
}
});
})()
.then(console.log)
.catch(console.error);
```
**Bookmarklet (not recommended):**
- Save this URL as a bookmark, clicking it will cause the file to inject itself into the current webpage.
- Does not work on all browsers
- Open your web browsers DevTools, `Ctrl` + `Shift` + `I`
- Navigate to the `console` tab
- The console will print: `AID_TOKEN="Your Token"`
- Repeat steps to refresh your token
```js filename="tests/browser.js"
javascript:(function(){['https://cdn.jsdelivr.net/gh/magicoflolis/aidungeon.js@master/tests/browser.js'].map(s=>document.body.appendChild(document.createElement('script')).src=s)})();
```
### Example Setup
> See [upload.js](https://github.com/magicoflolis/aidungeon.js/tree/main/tests/upload)
### TODO
- Add better examples
- Support custom queries