TheCommieAxolotl / BetterDiscord-Stuff

BetterDiscord Plugins and Themes
https://discord.gg/5BSWtSM3XU
MIT License
115 stars 293 forks source link

[Suggestion] [PreviewMessage] Very volatile patch #49

Closed rauenzi closed 10 months ago

rauenzi commented 10 months ago

In the plugin you use a very volatile patch that could cause rending issues when the structure is changed by discord. https://github.com/TheCommieAxolotl/BetterDiscord-Stuff/blob/58ba0f046e04f93cac647d430e6e15a15958e8c3/PreviewMessage/PreviewMessage.plugin.js#L114

I would recommend either doing a tree search (BdApi and the library have such utilities), or something like getNestedProp from the library. This way if something goes wrong or if the structure slightly changes it doesn't just error out and can be handled gracefully or even still work.