Sending double messages in admin chatSolved

Admin chat is sending double messages to discord. Appears only once on the server end and when sending from server -> discord it also only appears once however sending a message from discord -> server it will send two messages. If i disabled the replace discord message feature it will send one regular discord message and a server message as well.

 

I managed to fix the issue on my own. The problem is when the message is being sent on discord, it is calling the AdminChat hook OnAdminChat() which is getting processed by discord chat every time it is called. I had to modify both the DiscordChat plugin and the AdminChat plugin to make it recognize that the message is coming from discord and should not be processed on discord. The basic idea is to pass a boolean through the hook when sending the message from discord so it knows it is coming from discord. I made too many changes to write them here so I'll post the source code for both plugins for anyone to use if they run into the same problem as me.

AdminChat: https://pastebin.com/vUXaUTAh

DiscordChat: https://pastebin.com/LFuGScy7

Locked automatically