GeekyDeaks / discord-destinybot

Discord Destiny Bot
MIT License
8 stars 3 forks source link

Channel parsing limited to 100 messages #5

Open GeekyDeaks opened 8 years ago

GeekyDeaks commented 8 years ago

The discord API only allows 100 messages to be fetched per call. This may cause an issue with the current PSN parsing code later on.

unisys12 commented 8 years ago

Should be unlimited. Just double checked Discord.js source code and their examples. The method you are using, channel.getLogs just returns an instance of client.getChannelLogs(). Either way, if you do not pass a limit option, the default is set to 50 returned message bodies. I can see, in your case, that you are passing 100 as a limit. What seems to be happening on your end?

P.S. I tried setting my general text channel as the PSN channel, but... nothing really happened aside from some logging output showing that it was parsing ID's.

EX: bash 2016-08-14T20:31:28.850Z - debug: checking for PSN channels on server: FFC_Test_Server 2016-08-14T20:31:28.851Z - info: scraping PSN tags from FFC_Test_Server/general 2016-08-14T20:31:29.234Z - debug: parsing -id>|<@discord-id> 2016-08-14T20:31:29.235Z - debug: Token: -id> 2016-08-14T20:31:29.235Z - debug: Token: @discord-id 2016-08-14T20:31:29.236Z - debug: parsing -id>|<@discord-id> 2016-08-14T20:31:29.236Z - debug: Token: -id> 2016-08-14T20:31:29.237Z - debug: Token: @discord-id 2016-08-14T20:31:29.237Z - debug: parsing -id>|<@discord-id> 2016-08-14T20:31:29.237Z - debug: Token: -id> 2016-08-14T20:31:29.239Z - debug: Token: @discord-id 2016-08-14T20:31:29.240Z - debug: parsing -id>|<@discord-id> 2016-08-14T20:31:29.240Z - debug: Token: -id> 2016-08-14T20:31:29.240Z - debug: Token: @discord-id

GeekyDeaks commented 8 years ago

When I tried to increase the limit to over 100, I received an API error stating that the value cannot be more than 100. As mentioned in the other issue, this is a messy hack and I am not at all happy with it, but it worked around the way the current users operate on the server.

The parsing is crude, it first checks to see if the line contains a '-' followed by one or more characters, then a '|'. If it does, then it tries to parse the line in the form:

@discordid psn | game1, game2, ... | timezone

Take a look at #psn-dev for some examples.