Jda: A function to get a message by its id

Created on 5 Aug 2018  路  8Comments  路  Source: DV8FromTheWorld/JDA

Issue Type

  • [ ] Bug Report
  • [x] Feature Request

For questions join the official JDA discord server: https://discord.gg/0hMr4ce0tIl3SLv5

Description

I would love to see a function added to the Guild class which can get a Message by its id without me looping through all TextChannels.

Most helpful comment

I gladly reject this feature request and strongly advice you to switch to a different method not requiring to iterating over all channels :)

All 8 comments

Yeah this is why you would loop through all TextChannels. You already got a function for that.

And do multiple useless requests?

Yes, there is no other option if you don't know the id of the channel. I just thought it would be useful.

without me looping through all TextChannels.
Yeah this is why you would loop through all TextChannels

?

Whether this is implemented in JDA or your own code, in both cases it is your bot looping through the channels and by doing so exhausting its ratelimits, and possibly abusing the Discord API.

This is a terrible feature to have imo.
You should store the channel id together with the message id if you want to look that message up later on.

Iterating over all (possibly thousands) of textchannels and doing a REST request for each of them is a terrible idea. Not only will it cap out your ratelimit pretty damn fast, but it would also run for half an eternity (due to ratelimit AND it being a lot of REST calls, each taking a few 10ms)

I got you. I will therefore additionally store the textchannel id.

I gladly reject this feature request and strongly advice you to switch to a different method not requiring to iterating over all channels :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Frederikam picture Frederikam  路  4Comments

andrei1058 picture andrei1058  路  6Comments

MinnDevelopment picture MinnDevelopment  路  5Comments

Bastian picture Bastian  路  5Comments

hitsu420 picture hitsu420  路  6Comments