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)