API sendMessage w/Avatar
confuser opened this issue ยท 3 comments
Currently using DiscordUtil.sendMessage
to send punishment notifications in BanManager. A few users have requested that the avatar be set to the player causing the ban/mute etc.
Would it be possible to provide a method to set the avatar and user display name when sending a custom message?
Thanks in advance!
There's two ways to display avatars in messages,
The above (a embed), for that you can use EmbedBuilder
and then send the resulting embed directly via TextChannel#sendMessage
The bottom (a webhook message), for that you can use WebhookUtil#deliverMessage
or both at the same time, through the latter method with the former class
Thanks for the speedy response! Any configuration checks needed? Looking at VentureChat etc looks like Experiment_WebhookChatMessageDelivery
is checked among other things?
Would be great to have a public API method other plugins could use without needing to deepdive into DiscordSRV internals if possible?
Experiment_WebhookChatMessageDelivery
is really only used for chat messages, and different options such as join/leave/death/achievement messages using their own. No configuration checks are necessary; the methods will work eitherway.
But if you want to make it possible to switch between webhooks & regular bot messages you can add a config option in your plugin's config.