Discord Integration Forge

Discord Integration Forge

935k Downloads

[BUG] Mod fails to get channel with specified ID despite permissions

Lana-chan opened this issue ยท 3 comments

commented

What happened?
Discord Integration starts up and logs in as specified bot token correctly, but couldn't find the specified channel ID and therefore performs no actions. I've double-checked my token, my channel ID and the bot's permissions in the server. The bot works with other Discord plugins for older Minecraft versions. I must be missing something really silly.

What should happen?
Discord Integration should correctly find and use the specified channel.

Steps to reproduce
Start the Forge server with the specified config file.

Version
1.16.5

Platform
Forge 36.0.1

Mod version:
2.1.0

Config file

[general]
  botToken = "****"
  botChannel = "388511379889455125"
  botStatusName = "%online% players Online"
  botStatusType = "PLAYING"
  streamingURL = "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  enableUpdateChecker = true
  updateCheckerMinimumReleaseType = "beta"
[commands]
  adminRoleIDs = [  "288504270343634944", "288503935369740289", "401928559607808020"  ]

No config was changed from the default below this line.

Crash report if available (use https://hastebin.com)

[14:24:32] [Server thread/INFO] [STDOUT/]: [de.erdbeerbaerlp.dcintegration.forge.DiscordIntegration:serverStarted:176]: Started
[14:24:32] [Server thread/INFO] [STDERR/]: [de.erdbeerbaerlp.dcintegration.common.Discord:getChannel:268]: Failed to get channel with ID '388511379889455125', falling back to default channel
commented

Looks like I need to give JDA more time to initialize... (it needs to cache all channels and members before they can be accessed)

commented

I assume this might be due to recent changes in the Discord API? I've had a couple of my own bots break a lot and requiring rewrites due to APIs changing how they cache IDs...

commented

After some poking around, turns out this was indeed because of the new changes in Discord APIs I wasn't fully aware how to solve. You're now supposed to have one of these intents enabled in your bot's dashboard for it to be able to see all available users and channels, and then JDA will successfully connect.
image

I can consider this issue closed for now.