Skip to content

Commit

Permalink
fix snowflake to 0 comparison in url functions
Browse files Browse the repository at this point in the history
  • Loading branch information
ruslan-ilesik committed Sep 15, 2023
1 parent 5c83eb8 commit ddb17ea
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/dpp/utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,14 +551,14 @@ namespace dpp {
}

std::string message_url(const snowflake& guild_id, const snowflake& channel_id, const snowflake& message_id){
if (guild_id == snowflake(0) || channel_id == snowflake(0) || message_id == snowflake(0)) {
if (guild_id.empty() || channel_id.empty() || message_id.empty()) {
return "";
}
return url_host + "/channels/" + std::to_string(guild_id) + "/" + std::to_string(channel_id) + "/" + std::to_string(message_id);
}

std::string channel_url(const snowflake& guild_id, const snowflake& channel_id){
if (guild_id == snowflake(0) || channel_id == snowflake(0)) {
if (guild_id.empty() || channel_id.empty()) {
return "";
}
return url_host + "/channels/" + std::to_string(guild_id) + "/" + std::to_string(channel_id);
Expand All @@ -569,7 +569,7 @@ namespace dpp {
};

std::string user_url(const snowflake& user_id){
if (user_id == snowflake(0)) {
if (user_id.empty()) {
return "";
}
return url_host + "/users/" + std::to_string(user_id);
Expand Down

0 comments on commit ddb17ea

Please sign in to comment.