diff --git a/languages/locale_en.hpp b/languages/locale_en.hpp index 2bea00f..21e7a72 100644 --- a/languages/locale_en.hpp +++ b/languages/locale_en.hpp @@ -12,6 +12,17 @@ "Get someone elses profile picture as a picture" #define COMMAND_GET_PFP_ARGS_USER \ "Whose profile picture do you want to get(it can be yourself)" +#define COMMAND_GET_PFP_FAIL_NOT_A_MEMBER(userid) \ + "<@" + userid + \ + "> is not a member.\nYou can only get profile picture of " \ + "guild/server members!" +#define COMMAND_GET_PFP_RETURN_ONLY_PFP(userid, pfplink) \ + "<@" + userid + ">'s [discord profile picture](" + pfplink + ")" + +#define COMMAND_GET_PFP_RETURN_SERVER_AND_DISCORD_PFP(userid, discordpfp, \ + guildpfp) \ + "<@" + userid + ">'s [discord profile picture](" + discordpfp + \ + ") and their [server profile picture](" + guildpfp + ")" // Command about #define COMMAND_ABOUT_DESCRIPTION "Info about the bot" diff --git a/src/Base/Entry.cpp b/src/Base/Entry.cpp index e3bae60..930db95 100644 --- a/src/Base/Entry.cpp +++ b/src/Base/Entry.cpp @@ -6,14 +6,19 @@ #include #include #include +#include +#include #include +#include int main(int argc, char **argv) { // SQL database set up makeDatabases(); // Bot setup bullshit - dpp::cluster bot(TOKEN); + // Fucking intents man I hate this dumbcell app + dpp::cluster bot(TOKEN, dpp::i_unverified_default_intents | + dpp::i_privileged_intents); // Neat utility bot.on_log(dpp::utility::cout_logger()); @@ -36,7 +41,5 @@ int main(int argc, char **argv) { } }); - // Remove dpp::st_wait if you want it to return execution - // (so like async I assume?) bot.start(dpp::st_wait); } diff --git a/src/Commands/OtherCommands.cpp b/src/Commands/OtherCommands.cpp index a659831..632d4f2 100644 --- a/src/Commands/OtherCommands.cpp +++ b/src/Commands/OtherCommands.cpp @@ -1,7 +1,13 @@ #include "../../settings.hpp" #include +#include #include #include +#include + +#define DPP_AVATAR_GET_ARGS 1024, dpp::i_png, true + +// event.command.get_guild() to get guild void commandPing(const dpp::slashcommand_t &event, dpp::cluster &bot) { event.reply("Pong"); @@ -11,5 +17,19 @@ void commandAbout(const dpp::slashcommand_t &event, dpp::cluster &bot) { } void commandGetPFP(const dpp::slashcommand_t &event, dpp::cluster &bot) { - dpp::snowflake user = std::get(event.get_parameter("user")); + dpp::snowflake userID = std::get(event.get_parameter("user")); + dpp::guild_member member = event.command.get_resolved_member(userID); + if (member.user_id == 0) { + event.reply(COMMAND_GET_PFP_FAIL_NOT_A_MEMBER(userID.str())); + return; + } + std::string memberUrl = member.get_avatar_url(DPP_AVATAR_GET_ARGS), + discordUrl = + member.get_user()->get_avatar_url(DPP_AVATAR_GET_ARGS); + if (memberUrl.empty()) { + event.reply(COMMAND_GET_PFP_RETURN_ONLY_PFP(userID.str(), discordUrl)); + } else { + event.reply(COMMAND_GET_PFP_RETURN_SERVER_AND_DISCORD_PFP( + userID.str(), discordUrl, memberUrl)); + } }