Skip to content

Commit

Permalink
remove event.reply on error
Browse files Browse the repository at this point in the history
  • Loading branch information
braindigitalis committed Aug 7, 2024
1 parent ad6e9d7 commit 9c83e12
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 12 deletions.
1 change: 0 additions & 1 deletion src/campfire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ dpp::task<void> campfire(const dpp::interaction_create_t& event, player p) {
event.reply(event.command.type == dpp::it_application_command ? dpp::ir_channel_message_with_source : dpp::ir_update_message, m.set_flags(dpp::m_ephemeral), [event, &bot, m](const auto& cc) {
if (cc.is_error()) {
bot.log(dpp::ll_error, "Internal error displaying campfire:\n```json\n" + cc.http_info.body + "\n```\nMessage:\n```json\n" + m.build_json() + "\n```");
event.reply(dpp::message("Internal error displaying campfire:\n```json\n" + cc.http_info.body + "\n```\nMessage:\n```json\n" + m.build_json() + "\n```").set_flags(dpp::m_ephemeral));
}
});
}
Expand Down
8 changes: 1 addition & 7 deletions src/combat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,12 +391,7 @@ dpp::task<void> continue_pvp_combat(const dpp::interaction_create_t& event, play
dpp::message m(co_await get_pvp_round(event));
m.embeds[0].description += output.str();

event.reply(event.command.type == dpp::it_component_button ? dpp::ir_update_message : dpp::ir_channel_message_with_source, m.set_flags(dpp::m_ephemeral), [event, m, p](const auto& cc) {
if (cc.is_error()) {
//bot.log(dpp::ll_error, "Internal error displaying PvP combat location " + std::to_string(p.paragraph) + ": " + cc.http_info.body);
event.reply(dpp::message("Internal error displaying Pvp combat location " + std::to_string(p.paragraph) + ":\n```json\n" + cc.http_info.body + "\n```\nMessage:\n```json\n" + m.build_json() + "\n```").set_flags(dpp::m_ephemeral));
}
});
event.reply(event.command.type == dpp::it_component_button ? dpp::ir_update_message : dpp::ir_channel_message_with_source, m.set_flags(dpp::m_ephemeral));
co_return;
}

Expand Down Expand Up @@ -1030,7 +1025,6 @@ dpp::task<void> continue_combat(const dpp::interaction_create_t& event, player p
event.reply(event.command.type == dpp::it_component_button ? dpp::ir_update_message : dpp::ir_channel_message_with_source, m.set_flags(dpp::m_ephemeral), [event, &bot, m, p](const auto& cc) {
if (cc.is_error()) {
bot.log(dpp::ll_error, "Internal error displaying PvE combat " + std::to_string(p.after_fragment) + " location " + std::to_string(p.paragraph) + ": " + cc.http_info.body + " -- " + m.build_json());
event.reply(dpp::message("Internal error displaying PvE combat " + std::to_string(p.after_fragment) + " location " + std::to_string(p.paragraph) + ":\n```json\n" + cc.http_info.body + "\n```\nMessage:\n```json\n" + m.build_json() + "\n```").set_flags(dpp::m_ephemeral));
}
});

Expand Down
2 changes: 0 additions & 2 deletions src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1235,7 +1235,6 @@ dpp::task<void> bank(const dpp::interaction_create_t& event, player p) {
event.reply(event.command.type == dpp::it_application_command ? dpp::ir_channel_message_with_source : dpp::ir_update_message, m.set_flags(dpp::m_ephemeral), [event, &bot, m](const auto& cc) {
if (cc.is_error()) {
bot.log(dpp::ll_error, "Internal error displaying bank: " + cc.http_info.body + " Message: " + m.build_json());
event.reply(dpp::message("Internal error displaying bank:\n```json\n" + cc.http_info.body + "\n```\nMessage:\n```json\n" + m.build_json() + "\n```").set_flags(dpp::m_ephemeral));
}
});
}
Expand Down Expand Up @@ -1649,7 +1648,6 @@ dpp::task<void> continue_game(const dpp::interaction_create_t& event, player p)
event.reply(event.command.type == dpp::it_component_button ? dpp::ir_update_message : dpp::ir_channel_message_with_source, m.set_flags(dpp::m_ephemeral), [event, &bot, location, m](const auto& cc) {
if (cc.is_error()) {{
bot.log(dpp::ll_error, "Internal error displaying location " + std::to_string(location.id) + ":\n```json\n" + cc.http_info.body + "\n```\nMessage:\n```json\n" + m.build_json() + "\n```");
event.reply(dpp::message("Internal error displaying location " + std::to_string(location.id) + ":\n```json\n" + cc.http_info.body + "\n```\nMessage:\n```json\n" + m.build_json() + "\n```").set_flags(dpp::m_ephemeral));
}}
});
}
1 change: 0 additions & 1 deletion src/grimoire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ dpp::task<void> grimoire(const dpp::interaction_create_t& event, player p) {
event.reply(event.command.type == dpp::it_application_command ? dpp::ir_channel_message_with_source : dpp::ir_update_message, m.set_flags(dpp::m_ephemeral), [event, &bot, m](const auto& cc) {
if (cc.is_error()) {
bot.log(dpp::ll_error, "Internal error displaying grimoire:\n```json\n" + cc.http_info.body + "\n```\nMessage:\n```json\n" + m.build_json() + "\n```");
event.reply(dpp::message("Internal error displaying grimoire:\n```json\n" + cc.http_info.body + "\n```\nMessage:\n```json\n" + m.build_json() + "\n```").set_flags(dpp::m_ephemeral));
}
});
}
Expand Down
1 change: 0 additions & 1 deletion src/inventory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ dpp::task<void> inventory(const dpp::interaction_create_t& event, player p) {
event.reply(event.command.type == dpp::it_application_command ? dpp::ir_channel_message_with_source : dpp::ir_update_message, m.set_flags(dpp::m_ephemeral), [event, &bot, m](const auto& cc) {
if (cc.is_error()) {
bot.log(dpp::ll_error, "Internal error displaying inventory:\n```json\n" + cc.http_info.body + "\n```\nMessage:\n```json\n" + m.build_json() + "\n```");
event.reply(dpp::message("Internal error displaying inventory:\n```json\n" + cc.http_info.body + "\n```\nMessage:\n```json\n" + m.build_json() + "\n```").set_flags(dpp::m_ephemeral));
}
});
}
Expand Down

0 comments on commit 9c83e12

Please sign in to comment.