https://github.com/ir-engine/ir-bot
https://github.com/ir-engine/ir-bot
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/ir-engine/ir-bot
- Owner: ir-engine
- License: other
- Created: 2024-08-18T04:07:55.000Z (almost 2 years ago)
- Default Branch: dev
- Last Pushed: 2025-04-03T01:22:18.000Z (about 1 year ago)
- Last Synced: 2025-04-12T17:06:26.842Z (about 1 year ago)
- Language: TypeScript
- Size: 469 KB
- Stars: 0
- Watchers: 13
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# Bot API
```ts
import { Vector3 } from 'three'
import { EtherealEngineBot } from '@ir-engine/ir-bot/src/bot'
import { BotHooks } from '@ir-engine/ir-bot/src/bot/enums/BotHooks'
const maxTimeout = 10 * 1000
const bot = new EtherealEngineBot({ name: 'bot-1', headless: false, verbose: false })
const vector3 = new Vector3()
const domain = process.env.APP_HOST
const locationName = 'test'
const sqrt2 = Math.sqrt(2)
describe('My Bot Tests', () => {
beforeAll(async () => {
await bot.launchBrowser()
await bot.enterLocation(`https://${domain}/location/${locationName}`)
await bot.delay(1000)
await bot.runHook(BotHooks.InitializeBot)
}, maxTimeout)
afterAll(async () => {
await bot.delay(1000)
await bot.quit()
}, maxTimeout)
test('Can spawn in the world', async () => {
expect(
vector3.copy(await bot.runHook(BotHooks.GetPlayerPosition)).length()
).toBeLessThan(sqrt2 * 2) // sqrt2 * 2 is the default size of our spawn area
})
})
```