fix checks for is bot

This commit is contained in:
ouwou 2022-07-05 03:53:00 -04:00
parent 41e2478a6f
commit 5c7631e713
4 changed files with 8 additions and 3 deletions

View File

@ -1122,7 +1122,7 @@ ChatMessageHeader::ChatMessageHeader(const Message &data)
m_meta_ev.signal_button_press_event().connect(sigc::mem_fun(*this, &ChatMessageHeader::on_author_button_press));
if (author->IsBot || data.WebhookID.has_value()) {
if (author->IsABot() || data.WebhookID.has_value()) {
m_extra = Gtk::manage(new Gtk::Label);
m_extra->get_style_context()->add_class("message-container-extra");
m_extra->set_single_line_mode(true);
@ -1130,7 +1130,7 @@ ChatMessageHeader::ChatMessageHeader(const Message &data)
m_extra->set_can_focus(false);
m_extra->set_use_markup(true);
}
if (author->IsBot)
if (author->IsABot())
m_extra->set_markup("<b>BOT</b>");
else if (data.WebhookID.has_value())
m_extra->set_markup("<b>Webhook</b>");

View File

@ -1,6 +1,10 @@
#include "user.hpp"
#include "abaddon.hpp"
bool UserData::IsABot() const noexcept {
return IsBot.has_value() && *IsBot;
}
bool UserData::IsDeleted() const {
return Discriminator == "0000";
}

View File

@ -60,6 +60,7 @@ struct UserData {
friend void to_json(nlohmann::json &j, const UserData &m);
void update_from_json(const nlohmann::json &j);
[[nodiscard]] bool IsABot() const noexcept;
[[nodiscard]] bool IsDeleted() const;
[[nodiscard]] bool HasAvatar() const;
[[nodiscard]] bool HasAnimatedAvatar() const noexcept;

View File

@ -204,7 +204,7 @@ void GuildSettingsMembersPaneInfo::SetUser(Snowflake user_id) {
auto member = *discord.GetMember(user_id, GuildID);
member.User = discord.GetUser(user_id);
m_bot.set_visible(member.User->IsBot.has_value() && *member.User->IsBot);
m_bot.set_visible(member.User->IsABot());
m_id.set_text("User ID: " + std::to_string(user_id));
m_created.set_text("Account created: " + user_id.GetLocalTimestamp());