[SVN] updated to version 0.3.1

[DEP] [BROKE] new dependency: pytz (pip3 install pytz)
[FIX] fixed media downloading with telethon 0.18
[FIX] now using server time zone in status messages instead of UTC
[UPD] now removing chats & supergroups completely after we leaving with !leave command
[ADD] added commands:
      !remove — completely remove current user from contact list
      !import phone firstname lastname — try to add contact with phone number (untested)
This commit is contained in:
annelin
2018-07-01 21:29:34 +00:00
parent 0f648e6bd4
commit e66bda9cd8
5 changed files with 49 additions and 14 deletions

View File

@@ -3,9 +3,12 @@
"""
import types
import time
import pytz
from datetime import datetime
def display_tg_name(peer):
if hasattr(peer,'title') and hasattr(peer,'broadcast') and peer.broadcast: # channel
return '[C] ' + peer.title
@@ -36,6 +39,14 @@ def get_contact_jid(peer, gatejid):
else:
return None
def localtime(utc_dt):
if time.daylight:
offsetHour = time.altzone / 3600
else:
offsetHour = time.timezone / 3600
local_tz = pytz.timezone('Etc/GMT%+d' % offsetHour)
local_dt = utc_dt.replace(tzinfo = pytz.utc).astimezone(local_tz)
return local_tz.normalize(local_dt)
def var_dump(obj, depth=7, l=""):
# fall back to repr