add deleteallmymessages to tg user bot

This commit is contained in:
2021-12-15 15:01:38 +08:00
parent 07b9d4f240
commit 4bcf93f098
4 changed files with 93 additions and 23 deletions

16
util.py
View File

@@ -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 = []