add reconnect logic to rich presence
This commit is contained in:
		
							parent
							
								
									1eeaec78e3
								
							
						
					
					
						commit
						9dc3f1276d
					
				
					 1 changed files with 10 additions and 1 deletions
				
			
		
							
								
								
									
										11
									
								
								src/index.js
									
										
									
									
									
								
							
							
						
						
									
										11
									
								
								src/index.js
									
										
									
									
									
								
							| 
						 | 
					@ -78,9 +78,18 @@ client.once("ready", function () {
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
client.on("error", function () {});
 | 
					client.on("error", function () {});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
rpc.on("ready", function () {
 | 
					rpc.on("connected", function () {
 | 
				
			||||||
  updatePresence();
 | 
					  updatePresence();
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					rpc.once("ready", function () {
 | 
				
			||||||
 | 
					  rpc.transport.on("close", async function () {
 | 
				
			||||||
 | 
					    try {
 | 
				
			||||||
 | 
					      await rpc.transport.connect();
 | 
				
			||||||
 | 
					    } catch (err) {
 | 
				
			||||||
 | 
					      rpc.transport.emit("close");
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
rpc.on("error", function () {});
 | 
					rpc.on("error", function () {});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
client.on("messageCreate", function (msg) {
 | 
					client.on("messageCreate", function (msg) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue