Mods
This commit is contained in:
parent
6ce2a161c6
commit
8a40d9d102
23
main.py
23
main.py
|
@ -95,8 +95,26 @@ def string_to_number(input_string):
|
||||||
return scaled_number
|
return scaled_number
|
||||||
|
|
||||||
|
|
||||||
|
def clean_string(string):
|
||||||
|
return string.replace(""", '"')
|
||||||
|
|
||||||
|
|
||||||
|
def escape_quotes(string):
|
||||||
|
return string.replace('"', '\\"')
|
||||||
|
|
||||||
|
|
||||||
|
def remove_char(string, char):
|
||||||
|
return string.replace(char, "")
|
||||||
|
|
||||||
|
|
||||||
|
def clean_gifmaker(arg):
|
||||||
|
arg = clean_string(arg)
|
||||||
|
arg = remove_char(arg, ";")
|
||||||
|
return arg
|
||||||
|
|
||||||
|
|
||||||
def join_command(command):
|
def join_command(command):
|
||||||
return " ".join(f"\"{arg}\"" for arg in command)
|
return " ".join(f'"{arg}"' for arg in command)
|
||||||
|
|
||||||
|
|
||||||
def gifmaker_command(args):
|
def gifmaker_command(args):
|
||||||
|
@ -181,12 +199,14 @@ async def on_message(ws, message):
|
||||||
if len(args) >= 1:
|
if len(args) >= 1:
|
||||||
update_time()
|
update_time()
|
||||||
arg = " ".join(clean_list(args))
|
arg = " ".join(clean_list(args))
|
||||||
|
arg = clean_gifmaker(arg)
|
||||||
await gif_describe(arg, room_id)
|
await gif_describe(arg, room_id)
|
||||||
|
|
||||||
elif cmd == "wins" or cmd == "win":
|
elif cmd == "wins" or cmd == "win":
|
||||||
if len(args) >= 1:
|
if len(args) >= 1:
|
||||||
update_time()
|
update_time()
|
||||||
arg = " ".join(clean_list(args))
|
arg = " ".join(clean_list(args))
|
||||||
|
arg = clean_gifmaker(arg)
|
||||||
await gif_wins(arg, room_id)
|
await gif_wins(arg, room_id)
|
||||||
|
|
||||||
elif cmd == "numbers" or cmd == "number" or cmd == "nums" or cmd == "num":
|
elif cmd == "numbers" or cmd == "number" or cmd == "nums" or cmd == "num":
|
||||||
|
@ -197,6 +217,7 @@ async def on_message(ws, message):
|
||||||
else:
|
else:
|
||||||
arg = None
|
arg = None
|
||||||
|
|
||||||
|
arg = clean_gifmaker(arg)
|
||||||
await gif_numbers(arg, room_id)
|
await gif_numbers(arg, room_id)
|
||||||
|
|
||||||
elif cmd == "date" or cmd == "data" or cmd == "time" or cmd == "datetime":
|
elif cmd == "date" or cmd == "data" or cmd == "time" or cmd == "datetime":
|
||||||
|
|
Loading…
Reference in New Issue