javascript - how to pull message data from discord.js? - Stack Overflow

Discord.js is an API for Discord that allows the developers to make plugins for the program, discord. h

Discord.js is an API for Discord that allows the developers to make plugins for the program, discord. here's the link to the API code it's in js, .js/

Discord is setup to be like a server where you connect and chat on channels, my problem is how do I pull the message data from the channels.

What they did is setup all the channels in a JSON cache and within the channel, objects is another cache with the messages objects(what documentation says). But when I get to the message cache all I see is messages: Cache { limit: 1000 } }. How do I pull all the message objects from the channel?

Discord.js is an API for Discord that allows the developers to make plugins for the program, discord. here's the link to the API code it's in js, https://github./hydrabolt/discord.js/

Discord is setup to be like a server where you connect and chat on channels, my problem is how do I pull the message data from the channels.

What they did is setup all the channels in a JSON cache and within the channel, objects is another cache with the messages objects(what documentation says). But when I get to the message cache all I see is messages: Cache { limit: 1000 } }. How do I pull all the message objects from the channel?

Share Improve this question edited Mar 28, 2018 at 11:31 user948581 asked Aug 7, 2016 at 23:42 Electro lemonElectro lemon 731 gold badge1 silver badge6 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 2

For those using discord.js v8 or lower.

If you want to pull all the message objects from the channel I reend ignoring the cach and instead using getChannelLogs(channel, limit, options, callback) Which will allow you to fetch up to 100 messages at once, but those messages do not have to be cached within discord.js. You can quite easily create a recursive function that on the callback fetches more messages to fetch as many messages as you want.

That said server.channel.messages will be all of the messages in it that discord.js has cached. If it appears empty chances are no-one sent a message since the bot was activated.

source: http://discordjs.readthedocs.io/en/latest/docs_client.html#getchannellogs-channel-limit-options-callback

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742411402a4438885.html

相关推荐

  • javascript - how to pull message data from discord.js? - Stack Overflow

    Discord.js is an API for Discord that allows the developers to make plugins for the program, discord. h

    1天前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信