This commit is contained in:
Auric Vente 2024-02-21 09:40:24 -06:00
parent eea6573193
commit d43e3f4089
3 changed files with 2214 additions and 1 deletions

BIN
bird.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

2196
data/aves.txt Normal file

File diff suppressed because it is too large Load Diff

19
main.py
View File

@ -99,7 +99,7 @@ async def on_message(ws, message):
elif cmd == "help": elif cmd == "help":
update_time() update_time()
await send_message(ws, f"Commands: describe | wins | numbers | date", room_id) await send_message(ws, f"Commands: describe | wins | numbers | date | bird", room_id)
elif cmd == "describe": elif cmd == "describe":
if len(args) >= 1: if len(args) >= 1:
@ -119,6 +119,10 @@ async def on_message(ws, message):
update_time() update_time()
await gif_date(None, room_id) await gif_date(None, room_id)
elif cmd == "bird" or cmd == "birds" or cmd == "birb" or cmd == "birbs" or cmd == "brb":
update_time()
await gif_bird(None, room_id)
def get_input_path(name): def get_input_path(name):
return str(Path(HERE, name)) return str(Path(HERE, name))
@ -174,6 +178,19 @@ async def gif_date(who, room_id):
await run_gifmaker(command, room_id) await run_gifmaker(command, room_id)
async def gif_bird(who, room_id):
input_path = get_input_path("bird.png")
command = [
gifmaker,
gm_common,
f"--input '{input_path}'",
"--words '[randomx]' --randomfile data/aves.txt --bgcolor 0,0,0",
"--filter anyhue2 --frames 3 --fontsize 42 --fillwords",
]
await run_gifmaker(command, room_id)
async def run_gifmaker(command, room_id): async def run_gifmaker(command, room_id):
process = await asyncio.create_subprocess_shell( process = await asyncio.create_subprocess_shell(
" ".join(command), " ".join(command),