mirror of
https://github.com/lifegpc/pythonscript.git
synced 2026-06-05 11:08:49 +08:00
add deleteallmymessages to tg user bot
This commit is contained in:
16
util.py
16
util.py
@@ -1,5 +1,11 @@
|
||||
from time import strftime, localtime, timezone
|
||||
from typing import List
|
||||
try:
|
||||
from dateutil.parser import parse
|
||||
have_dateutil = True
|
||||
except ImportError:
|
||||
print('Warning: python-dateutil not found. -s and -e only accept integer now.') # noqa: E501
|
||||
have_dateutil = False
|
||||
|
||||
|
||||
def timeToStr(t: int) -> str:
|
||||
@@ -10,6 +16,16 @@ def timeToStr(t: int) -> str:
|
||||
return te
|
||||
|
||||
|
||||
def tparse(s: str) -> int:
|
||||
try:
|
||||
return int(s)
|
||||
except Exception:
|
||||
if have_dateutil:
|
||||
return round(parse(s).timestamp())
|
||||
else:
|
||||
raise ValueError()
|
||||
|
||||
|
||||
def commandLineToArgv(c: str) -> List[str]:
|
||||
s = c.split(' ')
|
||||
r = []
|
||||
|
||||
Reference in New Issue
Block a user