From 99840904476b4e88f76369556280ffb78054a50c Mon Sep 17 00:00:00 2001 From: Auric Vente Date: Thu, 22 Feb 2024 14:28:07 -0600 Subject: [PATCH] Mods --- main.py | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/main.py b/main.py index 83ed78b..11f1f1b 100644 --- a/main.py +++ b/main.py @@ -142,8 +142,13 @@ async def on_message(ws, message): await gif_wins(args[0], room_id) elif cmd == "numbers" or cmd == "number" or cmd == "nums" or cmd == "num": + if len(args) >= 1: + arg = args[0] + else: + arg = None + update_time() - await gif_numbers(args[0], room_id) + await gif_numbers(arg, room_id) elif cmd == "date" or cmd == "data" or cmd == "time" or cmd == "datetime": update_time() @@ -193,20 +198,23 @@ async def gif_wins(who, room_id): await run_gifmaker(command, room_id) async def gif_numbers(arg, room_id): - input_path = get_path("numbers.png") - numbers = extract_range(arg) num = -1 - if len(numbers) == 1: - if numbers[0] > 0: - num = random_int(0, numbers[0]) - elif len(numbers) == 2: - if numbers[0] < numbers[1]: - num = random_int(numbers[0], numbers[1]) + if arg: + numbers = extract_range(arg) - if num == -1: + if len(numbers) == 1: + if numbers[0] > 0: + num = random_int(0, numbers[0]) + elif len(numbers) == 2: + if numbers[0] < numbers[1]: + num = random_int(numbers[0], numbers[1]) + + if num <= 0: num = random_int(0, 999) + input_path = get_path("numbers.png") + command = [ gifmaker, gm_common,