feat(moyai): Add option to toggle triggering moyai when the window is not focused (#123)
This commit is contained in:
		
							parent
							
								
									7eba5b99b0
								
							
						
					
					
						commit
						350e7b0a6a
					
				
					 3 changed files with 13 additions and 2 deletions
				
			
		|  | @ -7,7 +7,7 @@ export default definePlugin({ | ||||||
|     description: "Disables Spotify auto-pausing, allows activity to continue playing when idling and bypasses premium checks, allowing you to listen along with others.", |     description: "Disables Spotify auto-pausing, allows activity to continue playing when idling and bypasses premium checks, allowing you to listen along with others.", | ||||||
|     authors: [ |     authors: [ | ||||||
|         Devs.Cyn, |         Devs.Cyn, | ||||||
|         { name: "Nuckyz", id: 235834946571337729n } |         Devs.Nuckyz | ||||||
|     ], |     ], | ||||||
| 
 | 
 | ||||||
|     patches: [{ |     patches: [{ | ||||||
|  |  | ||||||
|  | @ -33,7 +33,7 @@ const ignoreBots = true; | ||||||
| 
 | 
 | ||||||
| export default definePlugin({ | export default definePlugin({ | ||||||
|     name: "Moyai", |     name: "Moyai", | ||||||
|     authors: [Devs.Megu], |     authors: [Devs.Megu, Devs.Nuckyz], | ||||||
|     description: "🗿🗿🗿🗿🗿🗿🗿🗿", |     description: "🗿🗿🗿🗿🗿🗿🗿🗿", | ||||||
| 
 | 
 | ||||||
|     async onMessage(e: IMessageCreate) { |     async onMessage(e: IMessageCreate) { | ||||||
|  | @ -78,6 +78,12 @@ export default definePlugin({ | ||||||
|             markers: makeRange(0, 1, 0.1), |             markers: makeRange(0, 1, 0.1), | ||||||
|             default: 0.5, |             default: 0.5, | ||||||
|             stickToMarkers: false, |             stickToMarkers: false, | ||||||
|  |         }, | ||||||
|  |         triggerWhenUnfocused: { | ||||||
|  |             description: "Trigger the 🗿 even when the window is unfocused", | ||||||
|  |             type: OptionType.BOOLEAN, | ||||||
|  |             default: true, | ||||||
|  |             restartNeeded: false, | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| }); | }); | ||||||
|  | @ -112,6 +118,7 @@ function getMoyaiCount(message: string) { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function boom() { | function boom() { | ||||||
|  |     if (!Settings.plugins.Moyai.triggerWhenUnfocused && !document.hasFocus()) return; | ||||||
|     const audioElement = document.createElement("audio"); |     const audioElement = document.createElement("audio"); | ||||||
|     audioElement.src = MOYAI_URL; |     audioElement.src = MOYAI_URL; | ||||||
|     audioElement.volume = Settings.plugins.Moyai.volume; |     audioElement.volume = Settings.plugins.Moyai.volume; | ||||||
|  |  | ||||||
|  | @ -54,5 +54,9 @@ export const Devs = Object.freeze({ | ||||||
|     katlyn: { |     katlyn: { | ||||||
|         name: "katlyn", |         name: "katlyn", | ||||||
|         id: 250322741406859265n |         id: 250322741406859265n | ||||||
|  |     }, | ||||||
|  |     Nuckyz: { | ||||||
|  |         name: "Nuckyz", | ||||||
|  |         id: 235834946571337729n | ||||||
|     } |     } | ||||||
| }); | }); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue