Browse Source

feed/unfeed

Kirk Trombley 1 year ago
parent
commit
27d2edf8d1
1 changed files with 26 additions and 0 deletions
  1. 26 0
      commands/commands/simple.py

+ 26 - 0
commands/commands/simple.py

@@ -1,4 +1,5 @@
 import random
+from datetime import datetime, timedelta
 
 from rollbot import as_command, Message, RollbotFailure, Command, Attachment
 from rollbot.injection import (
@@ -168,3 +169,28 @@ def finchat(cmd: Command):
 @as_command
 def reply(msg: Message):
     return "Replying!", Attachment(name="reply", body=msg.message_id)
+
+
+last_feed = None
+hungry_messages = ("Oh fuck yes it's a little bowl of seeds for me", "Yippee!", "Thank you for the seeds!")
+not_hungry_messages = (hungry_messages[0], "Ooh even more seeds for me")
+
+
+@as_command
+def feed():
+    global last_feed
+    now = datetime.now()
+    msg = random.choice(
+        hungry_messages
+        if last_feed is None or now - last_feed > timedelta(days=1)
+        else not_hungry_messages
+    )
+    last_feed = now
+    return msg
+
+
+@as_command
+def unfeed():
+    global last_feed
+    last_feed = None
+    return random.choice(("What's your problem?", "Bro why", "Come on!!!!"))