diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2020-11-19 19:18:59 -0500 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2020-11-19 19:18:59 -0500 |
commit | deb482a8db55874a536b6efec366343280214e48 (patch) | |
tree | abd28a02e7b34309871618d141b52326ba7ea6fb /abaddon.cpp | |
parent | 1463d8da9e1b4c49021e6fa75795e2cd054b6227 (diff) | |
download | abaddon-portaudio-deb482a8db55874a536b6efec366343280214e48.tar.gz abaddon-portaudio-deb482a8db55874a536b6efec366343280214e48.zip |
initial sqlite, store user
Diffstat (limited to 'abaddon.cpp')
-rw-r--r-- | abaddon.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/abaddon.cpp b/abaddon.cpp index e9482f6..e833949 100644 --- a/abaddon.cpp +++ b/abaddon.cpp @@ -54,7 +54,6 @@ int Abaddon::StartGTK() { m_main_window = std::make_unique<MainWindow>(); m_main_window->set_title(APP_TITLE); - m_main_window->show(); m_main_window->UpdateComponents(); // crashes for some stupid reason if i put it somewhere else @@ -111,6 +110,13 @@ int Abaddon::StartGTK() { dlg.run(); } + if (!m_discord.IsStoreValid()) { + Gtk::MessageDialog dlg(*m_main_window, "The Discord cache could not be created!", false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true); + dlg.run(); + return 1; + } + + m_main_window->show(); return m_gtk_app->run(*m_main_window); } @@ -380,8 +386,8 @@ void Abaddon::ActionLeaveGuild(Snowflake id) { void Abaddon::ActionKickMember(Snowflake user_id, Snowflake guild_id) { ConfirmDialog dlg(*m_main_window); - const auto *user = m_discord.GetUser(user_id); - if (user != nullptr) + const auto user = m_discord.GetUser(user_id); + if (user.has_value()) dlg.SetConfirmText("Are you sure you want to kick " + user->Username + "#" + user->Discriminator + "?"); auto response = dlg.run(); if (response == Gtk::RESPONSE_OK) @@ -390,8 +396,8 @@ void Abaddon::ActionKickMember(Snowflake user_id, Snowflake guild_id) { void Abaddon::ActionBanMember(Snowflake user_id, Snowflake guild_id) { ConfirmDialog dlg(*m_main_window); - const auto *user = m_discord.GetUser(user_id); - if (user != nullptr) + const auto user = m_discord.GetUser(user_id); + if (user.has_value()) dlg.SetConfirmText("Are you sure you want to ban " + user->Username + "#" + user->Discriminator + "?"); auto response = dlg.run(); if (response == Gtk::RESPONSE_OK) |