Closed BradleyAKern closed 6 months ago
This creates the cluster with only the message content intent, without the default intents. You need to OR
it with dpp::i_default_intents
.
Following up from what @Axyte said, you can check out our documentation on this if you're confused! https://dpp.dev/detecting-messages.html
Sounds like an open and shut case, the problem was definitely that the cluster was being created without default intents. Thank you both for your help!
Sounds like an open and shut case, the problem was definitely that the cluster was being created without default intents. Thank you both for your help!
No problem!!
I am using the distribution of DPP included with the windows-bot-template, an example implementation of a Discord bot using DPP that is linked on the official DPP site.
Whenever my cluster is constructed using the
bot()
constructor with only the required token argument, like so:dpp::cluster bot(tokenString);
Everything works as expected. Every time a message is sent to a channel in my discord, the appropriate callback defined by theon_message_create()
call to my cluster will trigger.However, this also yields a warning message:
WARN: You have attached an event to cluster::on_message_create() but have not specified the privileged intent dpp::i_message_content. Message content, embeds, attachments, and components on received guild messages will be empty.
The message seems pretty self explanatory. In the Discord Developer Portal, I have ensured that my bot has the Message Content Intent enabled underneath Privileged Gateway Intents. Then, I updated the creation of my cluster from the above code to this:
dpp::cluster bot(tokenString, dpp::i_message_content);
After rebuilding and running my project, there are no warnings or errors, but also the callback from
on_message_create()
no longer gets called when a message is sent to my discord.This is the entirety of the C++ program, with the bot token censored:
I am currently building and running my application on Windows 10 using Visual Studio Community 2022 with the C++20 standard. I am testing using the desktop Discord client.