Created
          October 12, 2023 07:50 
        
      - 
      
- 
        Save huytd/71e7f1de289ca613c9f360f349776f9d to your computer and use it in GitHub Desktop. 
    Simple bot for tokyo-rs
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | const USERNAME = "rotate-bot"; | |
| const ws = require('ws'); | |
| const client = new ws(`wss://combat.sege.dev/socket?key=${USERNAME}&name=${USERNAME}`); | |
| client.on('open', () => { | |
| console.log('Connected!'); | |
| setInterval(() => { | |
| client.send(JSON.stringify({ | |
| "e": "throttle", | |
| "data": 1 | |
| })); | |
| }, 500); | |
| setInterval(() => { | |
| client.send(JSON.stringify({ | |
| "e": "fire" | |
| })); | |
| }, 1000); | |
| }); | |
| let rotate = 0; | |
| client.on('message', (data) => { | |
| const buffer = Buffer.from(data); | |
| const json = JSON.parse(buffer); | |
| console.log("TICK", Date.now()); | |
| console.log(json); | |
| client.send(JSON.stringify({ | |
| "e": "rotate", | |
| "data": rotate | |
| })) | |
| rotate += 0.2; | |
| }); | |
| client.on('close', () => { | |
| console.log('Disconnected!'); | |
| }); | 
        
      
            unrealhoang
  
      
      
      commented 
        Oct 13, 2023 
      
    
  
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment