core icon indicating copy to clipboard operation
core copied to clipboard

User last seen date

Open noplanman opened this issue 8 years ago • 0 comments

As @chuv1 has reported in the support group some time back, there is an issue with the modified_at date saved for the user being inserted to the DB.

It seems logical, that created_at date should be the first time the bot has ever heard of the user, be it the user posting a message, or a message from that user being forwarded to the bot.

What doesn't make sense though, is to set the updated_at date, to the date of a forwarded message, which is what happens now: https://github.com/php-telegram-bot/core/blob/0.44.1/src/DB.php#L789

The date should only be updated, if the user actually interacts with the bot.

Do you agree that this is the correct behaviour? Or is there any scenario where the current way makes perfect sense?

Also, should the updated_at field already be populated when the user first gets created, or only when the user himself/herself interacts with the bot?

e.g.

  1. User1 that has never spoken to the bot:
  • User1 writes a message to the bot
  • created_at and updated_at for User1 get set to the current time.
  1. Nr. 1 and a message from User1 gets forwarded to the bot by User2
  • User2 forwards message from User1 to the bot
  • created_at for User1 is now, updated_at stays empty.

@jacklul @MBoretto @akalongman

noplanman avatar May 02 '17 14:05 noplanman