Maselkov / GW2Bot

A GW2 Discord Bot
https://gw2bot.info
Other
50 stars 21 forks source link

New GW2 updater handling #144

Closed n1tr0-5urf3r closed 1 year ago

n1tr0-5urf3r commented 1 year ago

The basic idea is as follows:

  1. Check the RSS feed for the latest post
  2. Retrieve HTML source for that post from forum
  3. Do some regex and markdown parsing magic to get the patch notes out of that.
  4. Keep track in the database of number of already sent out messages per forum post.
  5. If amount of comments in the latest post exceeds the amount stored in the database, send out the new ones.

Worked in my test instance, but better test it by yourself first. The 4 latest patch notes might be pushed out on startup since the database is not populated.

Use for example the following mongosh line to test the behaviour. Alter the count value to emulate the behavior of new posts. db.gw2.updates.updateOne({"title": 'Game Update Notes: July 18, 2023'}, { "$set": {"title": 'Game Update Notes: July 18, 2023', "count": 2}}) will send out the last 2 update notes.