- Changed `test_data.js` to `test_data.json` - Added `deprecated` decorator - Added `deprecation` function - Readded old functions, and marked them as deprecated - Changed parameters back to being type-in-specific (support for python 2.x) - Deprecated `info_log` and `debug` init paramters
63 lines
1.4 KiB
Python
63 lines
1.4 KiB
Python
from __future__ import unicode_literals
|
|
import sys
|
|
from enum import Enum
|
|
|
|
class Base():
|
|
def __repr__(self):
|
|
uni = self.__unicode__()
|
|
return uni.encode('utf-8') if sys.version_info < (3, 0) else uni
|
|
|
|
def __unicode__(self):
|
|
return u'<%s %s (%s)>' % (self.type.upper(), self.name, self.url)
|
|
|
|
class User(Base):
|
|
def __init__(self, data):
|
|
if data['type'] != 'user':
|
|
raise Exception("[!] %s <%s> is not a user" % (data['text'], data['path']))
|
|
self.uid = data['uid']
|
|
self.type = data['type']
|
|
self.photo = data['photo']
|
|
self.url = data['path']
|
|
self.name = data['text']
|
|
self.score = data['score']
|
|
self.data = data
|
|
|
|
class Thread():
|
|
def __init__(self, **entries):
|
|
self.__dict__.update(entries)
|
|
|
|
class Message():
|
|
def __init__(self, **entries):
|
|
self.__dict__.update(entries)
|
|
|
|
class ThreadType(Enum):
|
|
USER = 1
|
|
GROUP = 2
|
|
|
|
class TypingStatus(Enum):
|
|
DELETED = 0
|
|
TYPING = 1
|
|
|
|
|
|
# WIP
|
|
class StickerSize(Enum):
|
|
LARGE = '369239383222810'
|
|
MEDIUM = '369239343222814'
|
|
SMALL = '369239263222822'
|
|
|
|
#class Size(Enum):
|
|
# LARGE = 'large'
|
|
# MEDIUM = 'medium'
|
|
# SMALL = 'small'
|
|
|
|
Size = StickerSize
|
|
|
|
LIKES = {
|
|
'l': Size.LARGE,
|
|
'm': Size.MEDIUM,
|
|
's': Size.SMALL
|
|
}
|
|
LIKES['large'] = LIKES['l']
|
|
LIKES['medium'] =LIKES['m']
|
|
LIKES['small'] = LIKES['s']
|