DiscordSRV

DiscordSRV

86.8k Downloads

[Solved] DiscordSendMessage / DiscordReceiveMessage events

Gunging opened this issue · 1 comments

commented

So one can make a plugin that parses a character sequence, lets say :thinking:, into an unused unicode character when a player sends a chat. Then make a font texture pack, and magic, players can now use 🤔 in the mc chat.

DiscordSRV will then send the following:
image

Thus, currently, one must use a very hacky method of running an Async Task that restores the original message (that has :thinking: instead of ) before DiscordSRV runs its own Async Task that actually sends the message to the server. The result is the expected:
image

However, its a bit uncomfortable to resort to this method, plus there is no way to intercept an incoming message to parse into

So basically:

  • DiscordSendMessageEvent that runs right before DiscordSRV sends a message to discord (and one can get/set the message as you would the to the AsyncPlayerChatEvent itself).
  • DiscordReceiveMessage that runs right before DiscordSRV broadcasts a message sent from discord (with same get/set functionality as described above).
commented

There are already events for this,

Discord -> Minecraft: DiscordGuildMessagePostProcessEvent
Minecraft -> Discord: GameChatMessagePostProcessEvent