Mention role in discord stream alert

I’m having a problem. I want to mention a role other than @everyone or @here in a discord stream alert. If i plainly put @ROLENAME in the alert message it all looks good, but the role does not actually get notified. It’s just plain text looking like a mention. If I, on the other hand, put <@&ROLEID> in the message the bot mentions/pings the role correctly in the message. You can’t mention roles in embeds however, so the twitch embed will have literally <@&ROLEID> in its title, which looks ugly. I’d open a PR to fix this, but I’m not sure what’s a good way to tackle the issue.

Java Version: 11.0.6+10-post-Debian-1bpo91
OS Version: Linux 4.14.98-v7+ (arm)
Panel Version: 1.0.2
PhantomBot Version: 3.1.2-NB-20200518 (nightly_build) (Revision: 94003bb)

But this also applies to 3.1.2 stable

This is, what this looks like:

Ok, I kept thinking about this… How about changing $.discord.say to check for some syntax that marks a mention that is then being looked up? You’d also need to come up with a way of escaping that syntax in case you want the bot to post it literally. Here is an example for such a syntax <@Robsdedude> could be turned into a real mention inside $.discord.say and an escaping could be \<@Robsdedude\>.

Advantages of pushing such a functionality all the way down to a low level function like $.discord.say:

  • Consistent behavior across all (custom) commands within all discord modules
  • DRY code

Disadvantages (rather a general disadvantages of the whole special syntax approach):

  • Documentation for this is needed so that users know how to use mentions
  • It would break backwards compatibility as some users might be using said syntax already and don’t expect it to suddenly turn into a mention (so this would be a change for a major update if you do semantic versioning)

A completely different approach could be to just fix the weird looking embeds. This is less intrusive but for the everyday user it isn’t easy to get to the raw mentions with the id as seen in the embed of the screenshot above. I got them by typing the mention in discord, then cutting the mention to the clipboard, write two backticks and paste the mention in between them. For some reason discord turns the mention into its raw format then. There also is a debug option in discord that can help to receive the raw format. But still, it’s hard and confusing. At least a solid documentation would be needed for that.