mirror of
https://gitlab.com/octospacc/WinDog.git
synced 2025-06-05 22:09:20 +02:00
Safebooru
This commit is contained in:
11
WinDog.py
11
WinDog.py
@@ -67,7 +67,7 @@ def SetupDb() -> None:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
def CharEscape(String, Escape='') -> str:
|
||||
def CharEscape(String:str, Escape:str='') -> str:
|
||||
if Escape == 'MARKDOWN':
|
||||
return escape_markdown(String, version=2)
|
||||
else:
|
||||
@@ -79,6 +79,9 @@ def CharEscape(String, Escape='') -> str:
|
||||
String = String.replace(c, '\\'+c)
|
||||
return String
|
||||
|
||||
def MarkdownCode(Text:str, Block:bool):
|
||||
return '```\n' + CharEscape(Text.strip(), 'MARKDOWN') + '\n```'
|
||||
|
||||
def CmdAllowed(update) -> bool:
|
||||
if not TGRestrict:
|
||||
return True
|
||||
@@ -140,6 +143,12 @@ def RandPercent() -> int:
|
||||
Num = str(Num) + '\.' + str(randint(0,9)) + str(randint(0,9))
|
||||
return Num
|
||||
|
||||
def RandHexStr(Len:int) -> str:
|
||||
Hex = ''
|
||||
for Char in range(Len):
|
||||
Hex += choice('0123456789abcdef')
|
||||
return Hex
|
||||
|
||||
#def CmdArgs(Msg:str, Cfg:tuple=None):
|
||||
# Args = []
|
||||
# Msg = Msg.strip().replace('\t', ' ')
|
||||
|
Reference in New Issue
Block a user