Support chinese variant, QQ object in launcher and some code optimizations
This commit is contained in:
35
worthless/classes/launcher/qq.py
Normal file
35
worthless/classes/launcher/qq.py
Normal 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)
|
||||
Reference in New Issue
Block a user