switched to uv and gitea-actions-based pipeline
All checks were successful
Build container / Build (pull_request) Successful in 43s
All checks were successful
Build container / Build (pull_request) Successful in 43s
This commit is contained in:
@@ -13,8 +13,8 @@ class SetChatPhotoJob():
|
||||
def __init__(self, bot: ExtBot, job_queue):
|
||||
self.bot = bot
|
||||
self.logger = logging.getLogger(self.__class__.__name__)
|
||||
|
||||
if os.getenv("DOCKERIZED", "false") != "true":
|
||||
|
||||
if models.IS_PRODUCTION:
|
||||
# when running locally, annoy the programmer every 60 seconds <3
|
||||
job_queue.run_repeating(self.callback_photo, interval=60)
|
||||
else:
|
||||
@@ -24,13 +24,13 @@ class SetChatPhotoJob():
|
||||
|
||||
|
||||
async def callback_photo(self, context):
|
||||
|
||||
|
||||
# last_seen of memory must be older than 10 days in past or None
|
||||
with models.db:
|
||||
possible_photos = models.JournalEntry.select().where(
|
||||
models.JournalEntry.media_path != None
|
||||
).order_by(fn.Random())
|
||||
|
||||
|
||||
try:
|
||||
chosen_entry = possible_photos.get()
|
||||
except:
|
||||
|
@@ -4,13 +4,14 @@ import os
|
||||
from peewee import fn
|
||||
import logging
|
||||
import models
|
||||
from telegram.ext import ExtBot
|
||||
|
||||
class RandomMemoryJob():
|
||||
def __init__(self, bot, job_queue):
|
||||
def __init__(self, bot: ExtBot, job_queue):
|
||||
self.bot = bot
|
||||
self.logger = logging.getLogger(self.__class__.__name__)
|
||||
|
||||
if os.getenv("DOCKERIZED", "false") != "true":
|
||||
|
||||
if models.IS_PRODUCTION:
|
||||
# when running locally, annoy the programmer every 60 seconds <3
|
||||
job_queue.run_repeating(self.callback_memory, interval=3600)
|
||||
self.min_age = 0 # do not filter messages: show them all
|
||||
@@ -22,14 +23,14 @@ class RandomMemoryJob():
|
||||
|
||||
|
||||
async def callback_memory(self, context):
|
||||
|
||||
|
||||
# last_seen of memory must be older than 10 days in past or None
|
||||
with models.db:
|
||||
possible_entries = models.JournalEntry.select().where(
|
||||
(models.JournalEntry.last_shown <= datetime.today().date() - timedelta(days=self.min_age)) | \
|
||||
(models.JournalEntry.last_shown == None)
|
||||
).order_by(fn.Random())
|
||||
|
||||
|
||||
try:
|
||||
chosen_entry = possible_entries.get()
|
||||
except:
|
||||
|
Reference in New Issue
Block a user