mirror of
https://github.com/celisej567/abaddon.git
synced 2026-09-13 20:18:50 +03:00
some refactorage
This commit is contained in:
@@ -553,7 +553,7 @@ Gtk::Widget *ChatMessageItemContainer::CreateReplyComponent(const Message &data)
|
||||
// clang-format off
|
||||
lbl->set_markup(
|
||||
"<b><span color=\"#" + IntToCSSColor(role->Color) + "\">"
|
||||
+ Glib::Markup::escape_text(author->Username + "#" + author->Discriminator)
|
||||
+ author->GetEscapedString()
|
||||
+ "</span></b>: "
|
||||
+ text
|
||||
);
|
||||
@@ -564,7 +564,7 @@ Gtk::Widget *ChatMessageItemContainer::CreateReplyComponent(const Message &data)
|
||||
}
|
||||
|
||||
const auto author = discord.GetUser(referenced.Author.ID);
|
||||
lbl->set_markup("<b>" + Glib::Markup::escape_text(author->Username + "#" + author->Discriminator) + "</b>: " + text);
|
||||
lbl->set_markup(author->GetEscapedBoldString<false>());
|
||||
}
|
||||
} else {
|
||||
lbl->set_markup("<i>reply unavailable</i>");
|
||||
@@ -615,14 +615,14 @@ void ChatMessageItemContainer::HandleUserMentions(Glib::RefPtr<Gtk::TextBuffer>
|
||||
Glib::ustring replacement;
|
||||
|
||||
if (channel->Type == ChannelType::DM || channel->Type == ChannelType::GROUP_DM)
|
||||
replacement = "<b>@" + Glib::Markup::escape_text(user->Username) + "#" + user->Discriminator + "</b>";
|
||||
replacement = user->GetEscapedBoldString<true>();
|
||||
else {
|
||||
const auto role_id = user->GetHoistedRole(*channel->GuildID, true);
|
||||
const auto role = discord.GetRole(role_id);
|
||||
if (!role.has_value())
|
||||
replacement = "<b>@" + Glib::Markup::escape_text(user->Username) + "#" + user->Discriminator + "</b>";
|
||||
replacement = user->GetEscapedBoldString<true>();
|
||||
else
|
||||
replacement = "<b><span color=\"#" + IntToCSSColor(role->Color) + "\">@" + Glib::Markup::escape_text(user->Username) + "#" + user->Discriminator + "</span></b>";
|
||||
replacement = "<span color=\"#" + IntToCSSColor(role->Color) + "\">" + user->GetEscapedBoldString<true>() + "</span>";
|
||||
}
|
||||
|
||||
// regex returns byte positions and theres no straightforward way in the c++ bindings to deal with that :(
|
||||
@@ -991,7 +991,7 @@ ChatMessageHeader::ChatMessageHeader(const Message *data) {
|
||||
m_avatar->set_valign(Gtk::ALIGN_START);
|
||||
m_avatar->set_margin_right(10);
|
||||
|
||||
m_author->set_markup("<span weight='bold'>" + Glib::Markup::escape_text(data->Author.Username) + "</span>");
|
||||
m_author->set_markup(data->Author.GetEscapedBoldName());
|
||||
m_author->set_single_line_mode(true);
|
||||
m_author->set_line_wrap(false);
|
||||
m_author->set_ellipsize(Pango::ELLIPSIZE_END);
|
||||
@@ -1091,9 +1091,9 @@ void ChatMessageHeader::UpdateNameColor() {
|
||||
|
||||
std::string md;
|
||||
if (role.has_value())
|
||||
md = "<span weight='bold' color='#" + IntToCSSColor(role->Color) + "'>" + Glib::Markup::escape_text(user->Username) + "</span>";
|
||||
md = "<span weight='bold' color='#" + IntToCSSColor(role->Color) + "'>" + user->GetEscapedName() + "</span>";
|
||||
else
|
||||
md = "<span weight='bold' color='#eeeeee'>" + Glib::Markup::escape_text(user->Username) + "</span>";
|
||||
md = "<span weight='bold' color='#eeeeee'>" + user->GetEscapedName() + "</span>";
|
||||
|
||||
m_author->set_markup(md);
|
||||
}
|
||||
|
||||
@@ -328,7 +328,7 @@ CompleterEntry::CompleterEntry(const Glib::ustring &completion, int index)
|
||||
void CompleterEntry::SetTextColor(int color) {
|
||||
if (m_text == nullptr) return;
|
||||
const auto cur = m_text->get_text();
|
||||
m_text->set_markup("<span color=\"#" + IntToCSSColor(color) + "\">" + Glib::Markup::escape_text(cur) + "</span>");
|
||||
m_text->set_markup("<span color='#" + IntToCSSColor(color) + "'>" + Glib::Markup::escape_text(cur) + "</span>");
|
||||
}
|
||||
|
||||
void CompleterEntry::SetText(const Glib::ustring &text) {
|
||||
|
||||
@@ -63,8 +63,7 @@ FriendPickerDialogItem::FriendPickerDialogItem(Snowflake user_id)
|
||||
, m_layout(Gtk::ORIENTATION_HORIZONTAL) {
|
||||
auto user = *Abaddon::Get().GetDiscordClient().GetUser(user_id);
|
||||
|
||||
m_name.set_markup("<b>" +
|
||||
Glib::Markup::escape_text(user.Username) + "</b>#" + user.Discriminator);
|
||||
m_name.set_markup(user.GetEscapedBoldString<false>());
|
||||
m_name.set_single_line_mode(true);
|
||||
|
||||
m_avatar.property_pixbuf() = Abaddon::Get().GetImageManager().GetPlaceholder(32);
|
||||
|
||||
@@ -21,6 +21,14 @@ std::string UserData::GetMention() const {
|
||||
return "<@" + std::to_string(ID) + ">";
|
||||
}
|
||||
|
||||
std::string UserData::GetEscapedName() const {
|
||||
return Glib::Markup::escape_text(Username);
|
||||
}
|
||||
|
||||
std::string UserData::GetEscapedBoldName() const {
|
||||
return "<b>" + Glib::Markup::escape_text(Username) + "</b>";
|
||||
}
|
||||
|
||||
std::string UserData::GetEscapedString() const {
|
||||
return Glib::Markup::escape_text(Username) + "#" + Discriminator;
|
||||
}
|
||||
|
||||
@@ -54,5 +54,14 @@ struct UserData {
|
||||
std::string GetAvatarURL(std::string ext = "png", std::string size = "32") const;
|
||||
Snowflake GetHoistedRole(Snowflake guild_id, bool with_color = false) const;
|
||||
std::string GetMention() const;
|
||||
std::string GetEscapedName() const;
|
||||
std::string GetEscapedBoldName() const;
|
||||
std::string GetEscapedString() const;
|
||||
template<bool with_at>
|
||||
inline std::string GetEscapedBoldString() const {
|
||||
if constexpr (with_at)
|
||||
return "<b>@" + Glib::Markup::escape_text(Username) + "</b>#" + Discriminator;
|
||||
else
|
||||
return "<b>" + Glib::Markup::escape_text(Username) + "</b>#" + Discriminator;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -36,8 +36,8 @@ void GuildSettingsAuditLogPane::OnAuditLogFetch(const AuditLogData &data) {
|
||||
switch (entry.Type) {
|
||||
case AuditLogActionType::GUILD_UPDATE: {
|
||||
markup =
|
||||
"<b>" + user.GetEscapedString() + "</b> " +
|
||||
"made changes to <b>" +
|
||||
user.GetEscapedBoldString<false>() +
|
||||
" made changes to <b>" +
|
||||
Glib::Markup::escape_text(guild.Name) +
|
||||
"</b>";
|
||||
|
||||
@@ -58,8 +58,8 @@ void GuildSettingsAuditLogPane::OnAuditLogFetch(const AuditLogData &data) {
|
||||
} break;
|
||||
case AuditLogActionType::CHANNEL_CREATE: {
|
||||
const auto type = *entry.GetNewFromKey<ChannelType>("type");
|
||||
markup = "<b>" + user.GetEscapedString() + "</b> " +
|
||||
"created a " + (type == ChannelType::GUILD_VOICE ? "voice" : "text") +
|
||||
markup = user.GetEscapedBoldString<false>() +
|
||||
" created a " + (type == ChannelType::GUILD_VOICE ? "voice" : "text") +
|
||||
" channel <b>#" +
|
||||
Glib::Markup::escape_text(*entry.GetNewFromKey<std::string>("name")) +
|
||||
"</b>";
|
||||
@@ -78,13 +78,13 @@ void GuildSettingsAuditLogPane::OnAuditLogFetch(const AuditLogData &data) {
|
||||
case AuditLogActionType::CHANNEL_UPDATE: {
|
||||
const auto target_channel = discord.GetChannel(entry.TargetID);
|
||||
if (target_channel.has_value()) {
|
||||
markup = "<b>" + user.GetEscapedString() + "</b> " +
|
||||
"made changes to <b>#" +
|
||||
markup = user.GetEscapedBoldString<false>() +
|
||||
" made changes to <b>#" +
|
||||
Glib::Markup::escape_text(*target_channel->Name) +
|
||||
"</b>";
|
||||
} else {
|
||||
markup = "<b>" + user.GetEscapedString() + "</b> " +
|
||||
"made changes to <b><#" +
|
||||
markup = user.GetEscapedBoldString<false>() +
|
||||
" made changes to <b><#" +
|
||||
entry.TargetID +
|
||||
"></b>";
|
||||
}
|
||||
@@ -121,57 +121,57 @@ void GuildSettingsAuditLogPane::OnAuditLogFetch(const AuditLogData &data) {
|
||||
}
|
||||
} break;
|
||||
case AuditLogActionType::CHANNEL_DELETE: {
|
||||
markup = "<b>" + user.GetEscapedString() + "</b> " +
|
||||
"removed <b>#" +
|
||||
markup = user.GetEscapedBoldString<false>() +
|
||||
" removed <b>#" +
|
||||
Glib::Markup::escape_text(*entry.GetOldFromKey<std::string>("name")) +
|
||||
"</b>";
|
||||
} break;
|
||||
case AuditLogActionType::CHANNEL_OVERWRITE_CREATE: {
|
||||
const auto channel = discord.GetChannel(entry.TargetID);
|
||||
if (channel.has_value()) {
|
||||
markup = "<b>" + user.GetEscapedString() + "</b> " +
|
||||
"created channel overrides for <b>#" +
|
||||
markup = user.GetEscapedBoldString<false>() +
|
||||
" created channel overrides for <b>#" +
|
||||
Glib::Markup::escape_text(*channel->Name) + "</b>";
|
||||
} else {
|
||||
markup = "<b>" + user.GetEscapedString() + "</b> " +
|
||||
"created channel overrides for <b><#" +
|
||||
markup = user.GetEscapedBoldString<false>() +
|
||||
" created channel overrides for <b><#" +
|
||||
entry.TargetID + "></b>";
|
||||
}
|
||||
} break;
|
||||
case AuditLogActionType::CHANNEL_OVERWRITE_UPDATE: {
|
||||
const auto channel = discord.GetChannel(entry.TargetID);
|
||||
if (channel.has_value()) {
|
||||
markup = "<b>" + user.GetEscapedString() + "</b> " +
|
||||
"updated channel overrides for <b>#" +
|
||||
markup = user.GetEscapedBoldString<false>() +
|
||||
" updated channel overrides for <b>#" +
|
||||
Glib::Markup::escape_text(*channel->Name) + "</b>";
|
||||
} else {
|
||||
markup = "<b>" + user.GetEscapedString() + "</b> " +
|
||||
"updated channel overrides for <b><#" +
|
||||
markup = user.GetEscapedBoldString<false>() +
|
||||
" updated channel overrides for <b><#" +
|
||||
entry.TargetID + "></b>";
|
||||
}
|
||||
} break;
|
||||
case AuditLogActionType::CHANNEL_OVERWRITE_DELETE: {
|
||||
const auto channel = discord.GetChannel(entry.TargetID);
|
||||
if (channel.has_value()) {
|
||||
markup = "<b>" + user.GetEscapedString() + "</b> " +
|
||||
"removed channel overrides for <b>#" +
|
||||
markup = user.GetEscapedBoldString<false>() +
|
||||
" removed channel overrides for <b>#" +
|
||||
Glib::Markup::escape_text(*channel->Name) + "</b>";
|
||||
} else {
|
||||
markup = "<b>" + user.GetEscapedString() + "</b> " +
|
||||
"removed channel overrides for <b><#" +
|
||||
markup = user.GetEscapedBoldString<false>() +
|
||||
" removed channel overrides for <b><#" +
|
||||
entry.TargetID + "></b>";
|
||||
}
|
||||
} break;
|
||||
case AuditLogActionType::MEMBER_KICK: {
|
||||
const auto target_user = discord.GetUser(entry.TargetID);
|
||||
markup = "<b>" + user.GetEscapedString() + "</b> " +
|
||||
"kicked <b>" +
|
||||
markup = user.GetEscapedBoldString<false>() +
|
||||
" kicked <b>" +
|
||||
target_user->GetEscapedString() +
|
||||
"</b>";
|
||||
} break;
|
||||
case AuditLogActionType::MEMBER_PRUNE: {
|
||||
markup = "<b>" + user.GetEscapedString() + "</b> " +
|
||||
"pruned <b>" +
|
||||
markup = user.GetEscapedBoldString<false>() +
|
||||
" pruned <b>" +
|
||||
*entry.Options->MembersRemoved +
|
||||
"</b> members";
|
||||
extra_markup.push_back("For <b>" +
|
||||
@@ -180,22 +180,22 @@ void GuildSettingsAuditLogPane::OnAuditLogFetch(const AuditLogData &data) {
|
||||
} break;
|
||||
case AuditLogActionType::MEMBER_BAN_ADD: {
|
||||
const auto target_user = discord.GetUser(entry.TargetID);
|
||||
markup = "<b>" + user.GetEscapedString() + "</b> " +
|
||||
"banned <b>" +
|
||||
markup = user.GetEscapedBoldString<false>() +
|
||||
" banned <b>" +
|
||||
target_user->GetEscapedString() +
|
||||
"</b>";
|
||||
} break;
|
||||
case AuditLogActionType::MEMBER_BAN_REMOVE: {
|
||||
const auto target_user = discord.GetUser(entry.TargetID);
|
||||
markup = "<b>" + user.GetEscapedString() + "</b> " +
|
||||
"removed the ban for <b>" +
|
||||
markup = user.GetEscapedBoldString<false>() +
|
||||
" removed the ban for <b>" +
|
||||
target_user->GetEscapedString() +
|
||||
"</b>";
|
||||
} break;
|
||||
case AuditLogActionType::MEMBER_UPDATE: {
|
||||
const auto target_user = discord.GetUser(entry.TargetID);
|
||||
markup = "<b>" + user.GetEscapedString() + "</b> " +
|
||||
"updated <b>" +
|
||||
markup = user.GetEscapedBoldString<false>() +
|
||||
" updated <b>" +
|
||||
target_user->GetEscapedString() +
|
||||
"</b>";
|
||||
if (entry.Changes.has_value())
|
||||
@@ -216,8 +216,8 @@ void GuildSettingsAuditLogPane::OnAuditLogFetch(const AuditLogData &data) {
|
||||
} break;
|
||||
case AuditLogActionType::MEMBER_ROLE_UPDATE: {
|
||||
const auto target_user = discord.GetUser(entry.TargetID);
|
||||
markup = "<b>" + user.GetEscapedString() + "</b> " +
|
||||
"updated roles for <b>" +
|
||||
markup = user.GetEscapedBoldString<false>() +
|
||||
" updated roles for <b>" +
|
||||
target_user->GetEscapedString() + "</b>";
|
||||
if (entry.Changes.has_value())
|
||||
for (const auto &change : *entry.Changes) {
|
||||
@@ -234,8 +234,8 @@ void GuildSettingsAuditLogPane::OnAuditLogFetch(const AuditLogData &data) {
|
||||
} break;
|
||||
case AuditLogActionType::MEMBER_MOVE: {
|
||||
const auto channel = discord.GetChannel(*entry.Options->ChannelID);
|
||||
markup = "<b>" + user.GetEscapedString() + "</b> " +
|
||||
"moved <b>" +
|
||||
markup = user.GetEscapedBoldString<false>() +
|
||||
" moved <b>" +
|
||||
*entry.Options->Count +
|
||||
" user" +
|
||||
(*entry.Options->Count == "1" ? ""s : "s"s) +
|
||||
@@ -244,28 +244,28 @@ void GuildSettingsAuditLogPane::OnAuditLogFetch(const AuditLogData &data) {
|
||||
"</b>";
|
||||
} break;
|
||||
case AuditLogActionType::MEMBER_DISCONNECT: {
|
||||
markup = "<b>" + user.GetEscapedString() + "</b> " +
|
||||
"disconnected <b>" +
|
||||
markup = user.GetEscapedBoldString<false>() +
|
||||
" disconnected <b>" +
|
||||
*entry.Options->Count +
|
||||
"</b> users from voice";
|
||||
} break;
|
||||
case AuditLogActionType::BOT_ADD: {
|
||||
const auto target_user = discord.GetUser(entry.TargetID);
|
||||
markup = "<b>" + user.GetEscapedString() + "</b> " +
|
||||
"added <b>" +
|
||||
markup = user.GetEscapedBoldString<false>() +
|
||||
" added <b>" +
|
||||
target_user->GetEscapedString() +
|
||||
"</b> to the server";
|
||||
} break;
|
||||
case AuditLogActionType::ROLE_CREATE: {
|
||||
markup = "<b>" + user.GetEscapedString() + "</b> " +
|
||||
"created the role <b>" +
|
||||
markup = user.GetEscapedBoldString<false>() +
|
||||
" created the role <b>" +
|
||||
*entry.GetNewFromKey<std::string>("name") +
|
||||
"</b>";
|
||||
} break;
|
||||
case AuditLogActionType::ROLE_UPDATE: {
|
||||
const auto role = discord.GetRole(entry.TargetID);
|
||||
markup = "<b>" + user.GetEscapedString() + "</b> " +
|
||||
"updated the role <b>" +
|
||||
markup = user.GetEscapedBoldString<false>() +
|
||||
" updated the role <b>" +
|
||||
(role.has_value() ? Glib::Markup::escape_text(role->Name) : Glib::ustring(entry.TargetID)) +
|
||||
"</b>";
|
||||
if (entry.Changes.has_value())
|
||||
@@ -292,15 +292,15 @@ void GuildSettingsAuditLogPane::OnAuditLogFetch(const AuditLogData &data) {
|
||||
}
|
||||
} break;
|
||||
case AuditLogActionType::ROLE_DELETE: {
|
||||
markup = "<b>" + user.GetEscapedString() + "</b> " +
|
||||
"deleted the role <b>" +
|
||||
markup = user.GetEscapedBoldString<false>() +
|
||||
" deleted the role <b>" +
|
||||
*entry.GetOldFromKey<std::string>("name") +
|
||||
"</b>";
|
||||
} break;
|
||||
case AuditLogActionType::INVITE_CREATE: {
|
||||
const auto code = *entry.GetNewFromKey<std::string>("code");
|
||||
markup = "<b>" + user.GetEscapedString() + "</b> " +
|
||||
"created an invite <b>" + code + "</b>";
|
||||
markup = user.GetEscapedBoldString<false>() +
|
||||
" created an invite <b>" + code + "</b>";
|
||||
if (entry.Changes.has_value())
|
||||
for (const auto &change : *entry.Changes) {
|
||||
if (change.Key == "channel_id" && change.NewValue.has_value()) {
|
||||
@@ -323,14 +323,14 @@ void GuildSettingsAuditLogPane::OnAuditLogFetch(const AuditLogData &data) {
|
||||
}
|
||||
} break;
|
||||
case AuditLogActionType::INVITE_DELETE: {
|
||||
markup = "<b>" + user.GetEscapedString() + "</b> " +
|
||||
"deleted an invite <b>" +
|
||||
markup = user.GetEscapedBoldString<false>() +
|
||||
" deleted an invite <b>" +
|
||||
*entry.GetOldFromKey<std::string>("code") +
|
||||
"</b>";
|
||||
} break;
|
||||
case AuditLogActionType::WEBHOOK_CREATE: {
|
||||
markup = "<b>" + user.GetEscapedString() + "</b> " +
|
||||
"created the webhook <b>" +
|
||||
markup = user.GetEscapedBoldString<false>() +
|
||||
" created the webhook <b>" +
|
||||
Glib::Markup::escape_text(*entry.GetNewFromKey<std::string>("name")) +
|
||||
"</b>";
|
||||
for (const auto &change : *entry.Changes) {
|
||||
@@ -351,13 +351,13 @@ void GuildSettingsAuditLogPane::OnAuditLogFetch(const AuditLogData &data) {
|
||||
webhookptr = &webhook;
|
||||
}
|
||||
if (webhookptr != nullptr) {
|
||||
markup = "<b>" + user.GetEscapedString() + "</b> " +
|
||||
"updated the webhook <b>" +
|
||||
markup = user.GetEscapedBoldString<false>() +
|
||||
" updated the webhook <b>" +
|
||||
Glib::Markup::escape_text(webhookptr->Name) +
|
||||
"</b>";
|
||||
} else {
|
||||
markup = "<b>" + user.GetEscapedString() + "</b> " +
|
||||
"updated a webhook";
|
||||
markup = user.GetEscapedBoldString<false>() +
|
||||
" updated a webhook";
|
||||
}
|
||||
if (entry.Changes.has_value())
|
||||
for (const auto &change : *entry.Changes) {
|
||||
@@ -380,20 +380,20 @@ void GuildSettingsAuditLogPane::OnAuditLogFetch(const AuditLogData &data) {
|
||||
}
|
||||
} break;
|
||||
case AuditLogActionType::WEBHOOK_DELETE: {
|
||||
markup = "<b>" + user.GetEscapedString() + "</b> " +
|
||||
"deleted the webhook <b>" +
|
||||
markup = user.GetEscapedBoldString<false>() +
|
||||
" deleted the webhook <b>" +
|
||||
Glib::Markup::escape_text(*entry.GetOldFromKey<std::string>("name")) +
|
||||
"</b>";
|
||||
} break;
|
||||
case AuditLogActionType::EMOJI_CREATE: {
|
||||
markup = "<b>" + user.GetEscapedString() + "</b> " +
|
||||
"created the emoji <b>" +
|
||||
markup = user.GetEscapedBoldString<false>() +
|
||||
" created the emoji <b>" +
|
||||
Glib::Markup::escape_text(*entry.GetNewFromKey<std::string>("name")) +
|
||||
"</b>";
|
||||
} break;
|
||||
case AuditLogActionType::EMOJI_UPDATE: {
|
||||
markup = "<b>" + user.GetEscapedString() + "</b> " +
|
||||
"updated the emoji <b>" +
|
||||
markup = user.GetEscapedBoldString<false>() +
|
||||
" updated the emoji <b>" +
|
||||
Glib::Markup::escape_text(*entry.GetOldFromKey<std::string>("name")) +
|
||||
"</b>";
|
||||
extra_markup.push_back("Changed the name from <b>" +
|
||||
@@ -403,8 +403,8 @@ void GuildSettingsAuditLogPane::OnAuditLogFetch(const AuditLogData &data) {
|
||||
"</b>");
|
||||
} break;
|
||||
case AuditLogActionType::EMOJI_DELETE: {
|
||||
markup = "<b>" + user.GetEscapedString() + "</b> " +
|
||||
"deleted the emoji <b>" +
|
||||
markup = user.GetEscapedBoldString<false>() +
|
||||
" deleted the emoji <b>" +
|
||||
Glib::Markup::escape_text(*entry.GetOldFromKey<std::string>("name")) +
|
||||
"</b>";
|
||||
} break;
|
||||
@@ -412,42 +412,42 @@ void GuildSettingsAuditLogPane::OnAuditLogFetch(const AuditLogData &data) {
|
||||
const auto channel = discord.GetChannel(*entry.Options->ChannelID);
|
||||
const auto count = *entry.Options->Count;
|
||||
if (channel.has_value()) {
|
||||
markup = "<b>" + user.GetEscapedString() + "</b> " +
|
||||
"deleted <b>" + count + "</b> messages in <b>#" +
|
||||
markup = user.GetEscapedBoldString<false>() +
|
||||
" deleted <b>" + count + "</b> messages in <b>#" +
|
||||
Glib::Markup::escape_text(*channel->Name) +
|
||||
"</b>";
|
||||
} else {
|
||||
markup = "<b>" + user.GetEscapedString() + "</b> " +
|
||||
"deleted <b>" + count + "</b> messages";
|
||||
markup = user.GetEscapedBoldString<false>() +
|
||||
" deleted <b>" + count + "</b> messages";
|
||||
}
|
||||
} break;
|
||||
case AuditLogActionType::MESSAGE_BULK_DELETE: {
|
||||
const auto channel = discord.GetChannel(entry.TargetID);
|
||||
if (channel.has_value()) {
|
||||
markup = "<b>" + user.GetEscapedString() + "</b> " +
|
||||
"deleted <b>" +
|
||||
markup = user.GetEscapedBoldString<false>() +
|
||||
" deleted <b>" +
|
||||
*entry.Options->Count +
|
||||
"</b> messages in <b>#" +
|
||||
Glib::Markup::escape_text(*channel->Name) +
|
||||
"</b>";
|
||||
} else {
|
||||
markup = "<b>" + user.GetEscapedString() + "</b> " +
|
||||
"deleted <b>" +
|
||||
markup = user.GetEscapedBoldString<false>() +
|
||||
" deleted <b>" +
|
||||
*entry.Options->Count +
|
||||
"</b> messages";
|
||||
}
|
||||
} break;
|
||||
case AuditLogActionType::MESSAGE_PIN: {
|
||||
const auto target_user = discord.GetUser(entry.TargetID);
|
||||
markup = "<b>" + user.GetEscapedString() + "</b> " +
|
||||
"pinned a message by <b>" +
|
||||
markup = user.GetEscapedBoldString<false>() +
|
||||
" pinned a message by <b>" +
|
||||
target_user->GetEscapedString() +
|
||||
"</b>";
|
||||
} break;
|
||||
case AuditLogActionType::MESSAGE_UNPIN: {
|
||||
const auto target_user = discord.GetUser(entry.TargetID);
|
||||
markup = "<b>" + user.GetEscapedString() + "</b> " +
|
||||
"unpinned a message by <b>" +
|
||||
markup = user.GetEscapedBoldString<false>() +
|
||||
" unpinned a message by <b>" +
|
||||
target_user->GetEscapedString() +
|
||||
"</b>";
|
||||
} break;
|
||||
|
||||
@@ -26,9 +26,7 @@ MutualFriendItem::MutualFriendItem(const UserData &user)
|
||||
}
|
||||
}
|
||||
|
||||
m_name.set_markup("<b>" +
|
||||
Glib::Markup::escape_text(user.Username) +
|
||||
"</b>#" + user.Discriminator);
|
||||
m_name.set_markup(user.GetEscapedBoldString<false>());
|
||||
|
||||
m_name.set_valign(Gtk::ALIGN_CENTER);
|
||||
add(m_avatar);
|
||||
|
||||
Reference in New Issue
Block a user