Support chinese variant, QQ object in launcher and some code optimizations

This commit is contained in:
2022-02-16 00:49:33 +07:00
parent 048a7ac9d0
commit c22918673b
19 changed files with 389 additions and 58 deletions

View File

@ -0,0 +1,35 @@
class QQ:
"""Contains the launcher QQ information
Note that QQ is not wrapped due to not having access to the chinese yuanshen launcher.
You can contribute to the project if you want :D
Attributes:
- :class:`str` qq_id: The id of the QQ post
- :class:`str` name: The name of the QQ post
- :class:`int` number: The number of the QQ post
- :class:`str` code: The QQ post url.
- :class:`dict` raw: The launcher raw information.
"""
def __init__(self, qq_id, name, number, code, raw):
self.qq_id = qq_id
self.name = name
self.number = number
self.code = code
self.raw = raw
@staticmethod
def from_dict(raw: dict) -> 'QQ':
"""Creates a QQ object from a dictionary
Args:
raw (dict): The raw dictionary
Returns:
QQ: The QQ object
"""
qq_id = raw.get('qq_id')
name = raw.get('name')
number = int(raw.get('number'))
code = raw.get('code')
return QQ(qq_id, name, number, code, raw)