Skip to content

Commit

Permalink
Merge pull request #50 from EtherealEngine/test/bot-test
Browse files Browse the repository at this point in the history
Updated some values to be more uniform, added startVideo and startAudio functions
  • Loading branch information
barankyle committed Jan 30, 2024
2 parents f73be91 + e0d0797 commit d7d0023
Showing 1 changed file with 23 additions and 8 deletions.
31 changes: 23 additions & 8 deletions src/bot/bot-class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,28 +130,29 @@ export class EtherealEngineBot {
switch (direction) {
case 'left':
await this.pressKey('A')
await this.delay(4000)
await this.delay(1000)
await this.releaseKey('A')
break;
break
case 'right':
await this.pressKey('D')
await this.delay(1000)
await this.releaseKey('D')
break;
break
case 'forward':
await this.pressKey('W')
await this.delay(4000)
await this.delay(1000)
await this.releaseKey('W')
break;
break
case 'backward':
await this.pressKey('S')
await this.delay(6000)
await this.delay(1000)
await this.releaseKey('S')
break;
break
case 'jump':
await this.pressKey('Space')
await this.delay(1000)
await this.releaseKey('Space')
break
case 'up':
await this.pressKey('ArrowUp')
await this.delay(1000)
Expand All @@ -175,6 +176,20 @@ export class EtherealEngineBot {
}
await this.delay(duration)
}
async startAudio() {
const clickmicrophone = await this.page.waitForSelector('[aria-label="Microphone"]')
if (clickmicrophone) {
await clickmicrophone.click()
await this.delay(1000)
}
}
async startVideo() {
const clickcamera = await this.page.waitForSelector('[aria-label="Camera"]')
if (clickcamera) {
await clickcamera.click()
await this.delay(1000)
}
}
async clickEmoteButtonAndSelectEmote() {
const emoteButton = await this.page.waitForSelector('[aria-label="Emote"]')
if (emoteButton) {
Expand Down Expand Up @@ -478,7 +493,7 @@ export class EtherealEngineBot {
context.overridePermissions(parsedUrl.origin, ['microphone', 'camera'])

console.log('Going to ' + url)
await this.page.goto(url, { waitUntil: 'domcontentloaded', timeout: 60 * 1000 })
await this.page.goto(url, { waitUntil: 'domcontentloaded', timeout: 1600 * 10000 })

const granted = await this.page.evaluate(async () => {
// @ts-ignore
Expand Down

0 comments on commit d7d0023

Please sign in to comment.