mirror of
https://github.com/celisej567/abaddon.git
synced 2026-09-19 20:11:59 +03:00
refactor, update user mention handling
This commit is contained in:
@@ -74,17 +74,17 @@ void HandleUserMentions(const Glib::RefPtr<Gtk::TextBuffer> &buf, Snowflake chan
|
||||
|
||||
if (channel->Type == ChannelType::DM || channel->Type == ChannelType::GROUP_DM || !channel->GuildID.has_value() || plain) {
|
||||
if (plain) {
|
||||
replacement = "@" + user->Username + "#" + user->Discriminator;
|
||||
replacement = "@" + user->GetUsername();
|
||||
} else {
|
||||
replacement = user->GetEscapedBoldString<true>();
|
||||
replacement = user->GetUsernameEscapedBold<true>();
|
||||
}
|
||||
} else {
|
||||
const auto role_id = user->GetHoistedRole(*channel->GuildID, true);
|
||||
const auto role = discord.GetRole(role_id);
|
||||
if (!role.has_value())
|
||||
replacement = user->GetEscapedBoldString<true>();
|
||||
replacement = user->GetUsernameEscapedBold<true>();
|
||||
else
|
||||
replacement = "<span color=\"#" + IntToCSSColor(role->Color) + "\">" + user->GetEscapedBoldString<true>() + "</span>";
|
||||
replacement = "<span color=\"#" + IntToCSSColor(role->Color) + "\">" + user->GetUsernameEscapedBold<true>() + "</span>";
|
||||
}
|
||||
|
||||
// regex returns byte positions and theres no straightforward way in the c++ bindings to deal with that :(
|
||||
|
||||
Reference in New Issue
Block a user