Comments (6)
By the looks of it did you not add the RoleEventListener class to your JDABuilder as a new event listener.
from jda.
I don't include my event listeners in the initial method chain off of the constructor. I register them individually later.
Message events seem to work just fine, these events are the only ones which seem to exhibit this behavior. Should I register them in the method chain instead?
from jda.
Well, a first step would be to share where and how you register them.
Next also make sure you actually have enabled the member priviledge on the Discord dev portal for your bot. Tho JDA would've given a warning on startup (and iirc not started) should it be missing.
from jda.
I register them shortly after I read in config, to prevent a race between an event firing and my config data not yet being present to guide how those events are handled:
try {
jda = JDABuilder.createDefault(discordBotToken)
.enableIntents(GatewayIntent.GUILD_MEMBERS, GatewayIntent.MESSAGE_CONTENT)
.setMemberCachePolicy(MemberCachePolicy.ALL)
.setAutoReconnect(true)
.build().awaitReady();
} catch (Exception e) {
Messaging.logException(e);
}
updateStatus("Starting...");
ConfigManager.createConfigIfNotExists(ConfigType.CORE);
config = (Config) ConfigManager.read(ConfigType.CORE);
// Write back the config so that if any new fields were added after an
// update, they are written to disk
ConfigManager.write(config);
ConfigManager.createConfigIfNotExists(ConfigType.DYNCMD);
dynCmdConfig = (DynCmdConfig) ConfigManager.read(ConfigType.DYNCMD);
ConfigManager.write(dynCmdConfig);
// some additional classes are instanced here but have no interaction with the event listeners
jda.addEventListener(roleEventListener = new RoleEventListener());
jda.addEventListener(messageEventListener = new MessageEventListener());
jda.addEventListener(memberEventListener = new MemberEventListener());
jda.addEventListener(slashCommandListener = new SlashCommandListener());
jda.addEventListener(messageCommandListener = new MessageContextCommandListener());
It is worth noting I am waiting until after this entire initialization process has finished before testing this behavior (my bot changes its presence status to indicate this entire init sequence has completed, plus I can see it clearly in the debug console).
I took care of the privileged gateway intents a long time ago for both my production and debug bot applications, else many features would stop working entirely:
from jda.
This event only fires once a member has been loaded into cache. Just because you set the cache policy to ALL
does not mean the member is cached right away, it is only cached once JDA sees any activity from them.
You can use GuildMemberUpdateEvent if you want to avoid relying on cache. Otherwise you have to explicitly load all members on startup into cache, using chunking filter.
from jda.
I see, I am a fool for not putting two and two together on the javadoc. I will work out what I need to do from here, thanks.
from jda.
Related Issues (20)
- Boost Event HOT 2
- member.canInteract() HOT 15
- GuildVoiceUpdateEvent is executed twice HOT 3
- Boost Event HOT 1
- Setting the thread id for a webhook create or update action doesn't work
- Maybe bug, slash command twice HOT 3
- Message delete is not working (Button Interaction) HOT 1
- First slash command registered does not register HOT 2
- Message delete error HOT 2
- Address CVE-2023-3635 HOT 1
- Add an interface that extends IReplyCallback and IModalCallback HOT 1
- Add TextInputInteractionEvent HOT 4
- Voice channel modify event problems HOT 1
- Clearing voice channel status returns internal server error
- canTalk returns true for private thread without permission HOT 2
- Voice connect return RestAction HOT 8
- Button#getLabel() is marked as @Nonnull, but is an optional field in API documentation HOT 3
- Message.getEmbeds() contains certain embeds only the second time they're sent HOT 7
- event.getTarget().getMember() returns null in onMessageContextInteraction HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jda.