Compare commits

...

2 Commits

Author SHA1 Message Date
cat
50454b8f74 Version bump + locale edit 2025-07-22 07:00:27 +03:00
cat
1134295242 Added intents and get_pfp command 2025-07-22 06:59:32 +03:00
3 changed files with 41 additions and 7 deletions

View File

@@ -1,6 +1,6 @@
// Bot info // Bot info
#define BOT_NAME "The Bartender Bot" #define BOT_NAME "The Bartender Bot"
#define BOT_VERSION "v0.2-2" #define BOT_VERSION "v0.3"
#define CURRENCY_NAME "Night Coin" #define CURRENCY_NAME "Night Coin"
@@ -9,9 +9,20 @@
// Command get_pfp // Command get_pfp
#define COMMAND_GET_PFP_DESCRIPTION \ #define COMMAND_GET_PFP_DESCRIPTION \
"Get someone elses profile picture as a picture" "Get someone elses profile picture as an image"
#define COMMAND_GET_PFP_ARGS_USER \ #define COMMAND_GET_PFP_ARGS_USER \
"Whose profile picture do you want to get(it can be yourself)" "Whose profile picture do you want to get(it can be of your own)"
#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 // Command about
#define COMMAND_ABOUT_DESCRIPTION "Info about the bot" #define COMMAND_ABOUT_DESCRIPTION "Info about the bot"

View File

@@ -6,14 +6,19 @@
#include <dpp/cluster.h> #include <dpp/cluster.h>
#include <dpp/dispatcher.h> #include <dpp/dispatcher.h>
#include <dpp/dpp.h> #include <dpp/dpp.h>
#include <dpp/intents.h>
#include <dpp/misc-enum.h>
#include <dpp/once.h> #include <dpp/once.h>
#include <string>
int main(int argc, char **argv) { int main(int argc, char **argv) {
// SQL database set up // SQL database set up
makeDatabases(); makeDatabases();
// Bot setup bullshit // 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 // Neat utility
bot.on_log(dpp::utility::cout_logger()); 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); bot.start(dpp::st_wait);
} }

View File

@@ -1,7 +1,13 @@
#include "../../settings.hpp" #include "../../settings.hpp"
#include <dpp/dispatcher.h> #include <dpp/dispatcher.h>
#include <dpp/dpp.h>
#include <dpp/guild.h> #include <dpp/guild.h>
#include <dpp/snowflake.h> #include <dpp/snowflake.h>
#include <dpp/user.h>
#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) { void commandPing(const dpp::slashcommand_t &event, dpp::cluster &bot) {
event.reply("Pong"); 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) { void commandGetPFP(const dpp::slashcommand_t &event, dpp::cluster &bot) {
dpp::snowflake user = std::get<dpp::snowflake>(event.get_parameter("user")); dpp::snowflake userID = std::get<dpp::snowflake>(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));
}
} }