Initial commit

This commit is contained in:
unknown 2024-09-12 19:15:21 +02:00 committed by draxaris1010
commit 64d8012945
2 changed files with 36 additions and 0 deletions

27
quotes.py Normal file
View file

@ -0,0 +1,27 @@
from rich.align import Align
from rich.layout import Layout
from rich.live import Live
from rich.text import Text
from rich.padding import Padding
import time
import requests
import random
quotes = requests.get('https://mattermore.zeus.gent/quotes.json').json()
def render_quote(quote):
for i in range(len(quote['quote'])):
l = Layout()
l.split_column(
Layout(f"Mattermost: ~{quote['channel']}", size=1),
Layout(Align.center(Padding(quote['quote'][:i+1], (0, 4)), vertical="middle")),
Layout(quote['created_at'][:10], size=1)
)
yield l
with Live(Layout(Align.center(Text("Yeet"), vertical="middle")), refresh_per_second=30) as live:
while True:
for q in render_quote(random.choice(quotes[-100:])):
live.update(q)
time.sleep(0.05)
time.sleep(30)

9
requirements.txt Normal file
View file

@ -0,0 +1,9 @@
certifi==2024.2.2
charset-normalizer==3.3.2
idna==3.6
markdown-it-py==3.0.0
mdurl==0.1.2
Pygments==2.17.2
requests==2.31.0
rich==13.7.1
urllib3==2.2.1