Changeset - 53e747f585b6
[Not reviewed]
default
0 1 0
Dennis Fink - 3 years ago 2022-07-19 19:31:13
dennis.fink@c3l.lu
Add more message with time
1 file changed with 8 insertions and 2 deletions:
0 comments (0 inline, 0 general)
spaceapi/utils.py
Show inline comments
 
@@ -5,8 +5,8 @@ import os.path
 
import random
 
import smtplib
 
import ssl
 
from datetime import datetime
 
from functools import partial
 
from time import time
 

	
 
import mastodon
 
import tweepy
 
@@ -32,6 +32,9 @@ possible_open_messages = (
 
    "Let the Chaos begin! We're open!",
 
    "What do we hack now? Come and see, we've just opened!",
 
    "TUWAT! Come and hack. We are open!",
 
    "It's {time:%H:%M} and we are open! Come and hack!",
 
    "We just opened our doors at {time:%H:%M}!",
 
    "Bootup process finished at {time:%H:%M}! Doors opened!",
 
)
 

	
 
possible_closed_messages = (
 
@@ -42,6 +45,8 @@ possible_closed_messages = (
 
    "Poweroff process finished! We're closed!",
 
    "Singularity reached! The space is closed!",
 
    "Dream of electric sheeps! We are closed!",
 
    "We closed our doors at {time:%H:%M}. See you soon.",
 
    "Poweroff process finished at {time:%H:%M}. We're closed!",
 
)
 

	
 

	
 
@@ -144,6 +149,7 @@ class ActiveStatusv14(Singleton, dict):
 
            if self["state"]["open"]
 
            else random.choice(possible_closed_messages)
 
        )
 
        message = message.format(time=datetime.now())
 
        self.send_tweet(message)
 
        self.send_toot(message)
 

	
 
@@ -224,7 +230,7 @@ class ActiveStatusv14(Singleton, dict):
 
            else:
 
                self["state"]["trigger_person"] = trigger_person
 

	
 
            self["state"]["lastchange"] = int(time())
 
            self["state"]["lastchange"] = int(datetime.now().timestamp())
 

	
 
        if message is not None and message:
 
            self["state"]["message"] = message
0 comments (0 inline, 0 general)