Initial commit
This commit is contained in:
commit
64d8012945
2 changed files with 36 additions and 0 deletions
27
quotes.py
Normal file
27
quotes.py
Normal 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
9
requirements.txt
Normal 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
|
Loading…
Reference in a new issue