Currently, from my reading of the code and anecdotal evidence from cpw's last updating of the #rules channel on Forgecord, whenever a channel is updated using K9's info command, it pings any users or roles within the message text (excluding embeds, because pings do not work in embeds).
This presents a difficulty whenever a server owner or administrator is updating such channels using the info command and the text contains mentions of roles or users (such as listing the staff roles of the server), because any update will cause a ping to be sent to all users, which means that server owners/administrators have to coordinate with these pinged users to make sure they know that this ping is due to an update of the rules channel (to avoid inciting irritation or anger from those users who hate pings with a passion unrivaled).
However, I have found a solution residing in the Discord Developer documentation for Channels, for the Allowed Mentions Object.
The Allowed Mentions object in messages allows granular control whether what mentions in a message will actually cause a ping to be sent to users. It allows controlling mentions for: roles, users, @everyone/@here, specific roles, and specific users.
As a side effect, it also disables the yellow background in messages with pings.
Image of my bot using the Allowed Mentions feature to prevent a ping to myselfImage of my bot using the Allowed Mentions feature to prevent a ping to another user, with their confirmationThe yellow background of the bot's message is due to it being a reply message (with mention) to my own command.
Discord4J implements this through MessageCreateSpec#setAllowedMentions(AllowedMentions), taking in an AllowedMentions object, built using its own Builder class which defaults to (to my understanding) an empty AllowedMentions object which prevents all mentions from becoming pings.
_As a reference, JDA implements this feature through MessageAction#allowedMentions(Collection<Message.MentionType>) and other related methods when sending messages. To implement this in my bot, I have passed in an empty collection, and the results of that are shown above._
This feature will be very useful to servers that use K9's info command to manage rules channels, so their owners/administrators can update the rules for e.g. spelling mistakes or minor clarifications, without having to ping and disturbed those mentioned users/roles. (cough Forgecord cough)
Currently, from my reading of the code and anecdotal evidence from cpw's last updating of the #rules channel on Forgecord, whenever a channel is updated using K9's
info
command, it pings any users or roles within the message text (excluding embeds, because pings do not work in embeds).This presents a difficulty whenever a server owner or administrator is updating such channels using the
info
command and the text contains mentions of roles or users (such as listing the staff roles of the server), because any update will cause a ping to be sent to all users, which means that server owners/administrators have to coordinate with these pinged users to make sure they know that this ping is due to an update of the rules channel (to avoid inciting irritation or anger from those users who hate pings with a passion unrivaled).However, I have found a solution residing in the Discord Developer documentation for Channels, for the Allowed Mentions Object. The Allowed Mentions object in messages allows granular control whether what mentions in a message will actually cause a ping to be sent to users. It allows controlling mentions for: roles, users,
@everyone
/@here
, specific roles, and specific users. As a side effect, it also disables the yellow background in messages with pings.Image of my bot using the Allowed Mentions feature to prevent a ping to myself
Image of my bot using the Allowed Mentions feature to prevent a ping to another user, with their confirmation
The yellow background of the bot's message is due to it being a reply message (with mention) to my own command.Discord4J implements this through
MessageCreateSpec#setAllowedMentions(AllowedMentions)
, taking in anAllowedMentions
object, built using its ownBuilder
class which defaults to (to my understanding) an emptyAllowedMentions
object which prevents all mentions from becoming pings. _As a reference, JDA implements this feature throughMessageAction#allowedMentions(Collection<Message.MentionType>)
and other related methods when sending messages. To implement this in my bot, I have passed in an empty collection, and the results of that are shown above._This feature will be very useful to servers that use K9's
info
command to manage rules channels, so their owners/administrators can update the rules for e.g. spelling mistakes or minor clarifications, without having to ping and disturbed those mentioned users/roles. (cough Forgecord cough)