Fixes and make guild tooltip show users inside hidden voice channels (#613)
* Fix #509 * Fix #597 * Fix #594
This commit is contained in:
		
							parent
							
								
									4aff11421f
								
							
						
					
					
						commit
						e36f4e5b0a
					
				
					 5 changed files with 23 additions and 10 deletions
				
			
		|  | @ -50,7 +50,7 @@ async function init() { | |||
|                 await update(); | ||||
|                 const needsFullRestart = await rebuild(); | ||||
|                 if (Settings.autoUpdateNotification) | ||||
|                     showNotification({ | ||||
|                     setTimeout(() => showNotification({ | ||||
|                         title: "Vencord has been updated!", | ||||
|                         body: "Click here to restart", | ||||
|                         permanent: true, | ||||
|  | @ -60,19 +60,19 @@ async function init() { | |||
|                             else | ||||
|                                 location.reload(); | ||||
|                         } | ||||
|                     }); | ||||
|                     }), 10_000); | ||||
|                 return; | ||||
|             } | ||||
| 
 | ||||
|             if (Settings.notifyAboutUpdates) | ||||
|                 showNotification({ | ||||
|                 setTimeout(() => showNotification({ | ||||
|                     title: "A Vencord update is available!", | ||||
|                     body: "Click here to view the update", | ||||
|                     permanent: true, | ||||
|                     onClick() { | ||||
|                         SettingsRouter.open("VencordUpdater"); | ||||
|                     } | ||||
|                 }); | ||||
|                 }), 10_000); | ||||
|         } catch (err) { | ||||
|             UpdateLogger.error("Failed to check for updates", err); | ||||
|         } | ||||
|  |  | |||
|  | @ -18,6 +18,7 @@ | |||
| 
 | ||||
| import "./Switch.css"; | ||||
| 
 | ||||
| import { classes } from "@utils/misc"; | ||||
| import { findByPropsLazy } from "@webpack"; | ||||
| 
 | ||||
| interface SwitchProps { | ||||
|  | @ -33,7 +34,7 @@ const SwitchClasses = findByPropsLazy("slider", "input", "container"); | |||
| export function Switch({ checked, onChange, disabled }: SwitchProps) { | ||||
|     return ( | ||||
|         <div> | ||||
|             <div className={`${SwitchClasses.container} default-colors`} style={{ | ||||
|             <div className={classes(SwitchClasses.container, "default-colors", checked ? SwitchClasses.checked : void 0)} style={{ | ||||
|                 backgroundColor: checked ? SWITCH_ON : SWITCH_OFF, | ||||
|                 opacity: disabled ? 0.3 : 1 | ||||
|             }}> | ||||
|  |  | |||
|  | @ -174,6 +174,7 @@ export default definePlugin({ | |||
|                     match: /(MESSAGE_UPDATE:function\((\w)\).+?)\.update\((\w)/, | ||||
|                     replace: "$1" + | ||||
|                         ".update($3,m =>" + | ||||
|                         "   (($2.message.flags & 64) === 64 || (Vencord.Settings.plugins.MessageLogger.ignoreBots && $2.message.author?.bot) || (Vencord.Settings.plugins.MessageLogger.ignoreSelf && $2.message.author?.id === Vencord.Webpack.Common.UserStore.getCurrentUser().id)) ? m :" + | ||||
|                         "   $2.message.content !== m.editHistory?.[0]?.content && $2.message.content !== m.content ?" + | ||||
|                         "       m.set('editHistory',[...(m.editHistory || []), $self.makeEdit($2.message, m)]) :" + | ||||
|                         "       m" + | ||||
|  |  | |||
|  | @ -37,16 +37,19 @@ export default definePlugin({ | |||
|                 } | ||||
|             ] | ||||
|         }, | ||||
|         { | ||||
|             find: "displayName=\"MessageStore\"", | ||||
|         ...[ | ||||
|             'displayName="MessageStore"', | ||||
|             'displayName="ReadStateStore"' | ||||
|         ].map(find => ({ | ||||
|             find, | ||||
|             predicate: () => Settings.plugins.NoBlockedMessages.ignoreBlockedMessages === true, | ||||
|             replacement: [ | ||||
|                 { | ||||
|                     match: /(?<=MESSAGE_CREATE:function\((\w)\){var \w=\w\.channelId,\w=\w\.message,\w=\w\.isPushNotification,\w=\w\.\w\.getOrCreate\(\w\));/, | ||||
|                     replace: ";if($self.isBlocked(n))return;" | ||||
|                     match: /(?<=MESSAGE_CREATE:function\((\i)\){)/, | ||||
|                     replace: (_, props) => `if($self.isBlocked(${props}.message))return;` | ||||
|                 } | ||||
|             ] | ||||
|         } | ||||
|         })) | ||||
|     ], | ||||
|     options: { | ||||
|         ignoreBlockedMessages: { | ||||
|  |  | |||
|  | @ -335,6 +335,14 @@ export default definePlugin({ | |||
|                 match: /(?<=getChannel\((\i)\)\)(?=.{0,100}?selectVoiceChannel))/, | ||||
|                 replace: (_, channelId) => `&&!$self.isHiddenChannel({channelId:${channelId}})` | ||||
|             } | ||||
|         }, | ||||
|         { | ||||
|             find: '.displayName="GuildChannelStore"', | ||||
|             replacement: { | ||||
|                 // Make GuildChannelStore contain hidden channels for users in voice channels to appear in the guild tooltip
 | ||||
|                 match: /isChannelGated\(.+?\)(?=\|\|)/, | ||||
|                 replace: m => `${m}||true` | ||||
|             } | ||||
|         } | ||||
|     ], | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue