ass-a-service / ajobot

More ajos!
MIT License
9 stars 3 forks source link

Implement steal command #34

Open axl89 opened 2 years ago

axl89 commented 2 years ago

Implement the /steal command to steal ajos from other players. It should be possible for the other player (if the player realizes that it's being robbed) to knock the stealer back and prevent this from happening. Maybe removing some ajos from the stealar? Or increasing bad karma? It was @Zymna 's idea after all, man.

axl89 commented 2 years ago

Started work in https://github.com/ass-a-service/ajobot/pull/35

axl89 commented 2 years ago

Maybe use redis keyspace notifications for expiring keys for the steal action? Something like:

  1. User A tries to steal n ajos from user B.
  2. Pre-checks and all that stuff (e.g. does B has, at least, n ajos?, etc.)
  3. Set a key (usera:steal) so the user can't steal from more people. This key is to expire in t seconds (probably related with the size of n).
  4. When the key expires, a keyspace notification "is kind of sent" and the steal action takes place.

EDIT: I think this is a bad way of implementing it. Maybe using delayed tasks instead?