mirror of
https://github.com/RPCS3/discord-bot.git
synced 2026-01-31 01:25:22 +01:00
Sanitize user input when showin compat search results Truncate compat search text to 40 characters to prevent dos with giant strings
18 lines
369 B
Python
18 lines
369 B
Python
import time
|
|
|
|
|
|
def trim_string(string: str, length: int) -> str:
|
|
if len(string) > length:
|
|
return string[:length - 3] + "..."
|
|
else:
|
|
return string
|
|
|
|
|
|
def system_time_millis() -> int:
|
|
return int(round(time.time() * 1000))
|
|
|
|
|
|
def sanitize_string(s: str) -> str:
|
|
return s.replace("`", "`\u200d").replace("@", "@\u200d") if s is not None else s
|
|
|