Added intents and get_pfp command
This commit is contained in:
@@ -12,6 +12,17 @@
|
|||||||
"Get someone elses profile picture as a picture"
|
"Get someone elses profile picture as a picture"
|
||||||
#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 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
|
// Command about
|
||||||
#define COMMAND_ABOUT_DESCRIPTION "Info about the bot"
|
#define COMMAND_ABOUT_DESCRIPTION "Info about the bot"
|
||||||
|
@@ -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);
|
||||||
}
|
}
|
||||||
|
@@ -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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user