mirror of
				https://github.com/keanuplayz/TravBot-v3.git
				synced 2024-08-15 02:33:12 +00:00 
			
		
		
		
	WIP: Make Lavalink optional
At the moment, there's a broken instance of the Lavalink system running. When executing `.play`, our home-hosted `musicbot` will start playing, but the production TravBot instance will error. I haven't implemented this as a choice in the setup yet, that's for another time. Right now, all I need is for it to be optional.
This commit is contained in:
		
							parent
							
								
									1e673a3969
								
							
						
					
					
						commit
						ac81b6a103
					
				
					 2 changed files with 43 additions and 39 deletions
				
			
		|  | @ -2,6 +2,7 @@ import attachClientToLavalink from "discord.js-lavalink-lib"; | ||||||
| import {Config} from "../structures"; | import {Config} from "../structures"; | ||||||
| import {client} from "../index"; | import {client} from "../index"; | ||||||
| 
 | 
 | ||||||
|  | if (Config.lavalink) { | ||||||
|     // Although the example showed to do "client.music = LavaLink(...)" and "(client as any).music = Lavalink(...)" was done to match that, nowhere in the library is client.music ever actually used nor does the function return anything. In other words, client.music is undefined and is never used.
 |     // Although the example showed to do "client.music = LavaLink(...)" and "(client as any).music = Lavalink(...)" was done to match that, nowhere in the library is client.music ever actually used nor does the function return anything. In other words, client.music is undefined and is never used.
 | ||||||
|     attachClientToLavalink(client, { |     attachClientToLavalink(client, { | ||||||
|         lavalink: { |         lavalink: { | ||||||
|  | @ -47,3 +48,4 @@ for (const listener of process.listeners("uncaughtException")) { | ||||||
|             process.off("uncaughtException", listener); |             process.off("uncaughtException", listener); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -13,6 +13,7 @@ class ConfigStructure extends GenericStructure { | ||||||
|     public owner: string; |     public owner: string; | ||||||
|     public admins: string[]; |     public admins: string[]; | ||||||
|     public support: string[]; |     public support: string[]; | ||||||
|  |     public lavalink: boolean | null; | ||||||
|     public systemLogsChannel: string | null; |     public systemLogsChannel: string | null; | ||||||
|     public webhooks: {[id: string]: string}; // id-token pairs
 |     public webhooks: {[id: string]: string}; // id-token pairs
 | ||||||
| 
 | 
 | ||||||
|  | @ -23,6 +24,7 @@ class ConfigStructure extends GenericStructure { | ||||||
|         this.owner = select(data.owner, "", String); |         this.owner = select(data.owner, "", String); | ||||||
|         this.admins = select(data.admins, [], String, true); |         this.admins = select(data.admins, [], String, true); | ||||||
|         this.support = select(data.support, [], String, true); |         this.support = select(data.support, [], String, true); | ||||||
|  |         this.lavalink = select(data.lavalink, null, Boolean); | ||||||
|         this.systemLogsChannel = select(data.systemLogsChannel, null, String); |         this.systemLogsChannel = select(data.systemLogsChannel, null, String); | ||||||
|         this.webhooks = {}; |         this.webhooks = {}; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue