Simplify and fix config scanning
This commit is contained in:
parent
157e8c1b17
commit
486cb82773
3 changed files with 82 additions and 84 deletions
|
|
@ -251,6 +251,7 @@ class User: # TODO : complete attributes
|
|||
username: str
|
||||
discriminator: str
|
||||
global_name: str | None
|
||||
bot: bool
|
||||
|
||||
@staticmethod
|
||||
def from_dict(info: dict) -> User:
|
||||
|
|
@ -258,7 +259,8 @@ class User: # TODO : complete attributes
|
|||
id=int(info['id']),
|
||||
username=info['username'],
|
||||
discriminator=info['discriminator'],
|
||||
global_name=info.get('global_name'))
|
||||
global_name=info.get('global_name'),
|
||||
bot=info.get('bot', False))
|
||||
|
||||
|
||||
class AttachmentFlags(IntFlag):
|
||||
|
|
@ -421,7 +423,7 @@ class Message: # TODO : complete attributes
|
|||
id=int(info['id']),
|
||||
channel_id=int(info['channel_id']),
|
||||
author=(User.from_dict(info['author']) if info.get('webhook_id') is None else User(
|
||||
id=info['webhook_id'], username='webhook', discriminator='webhook', global_name=None)),
|
||||
id=info['webhook_id'], username='webhook', discriminator='webhook', global_name=None, bot=False)),
|
||||
content=info['content'],
|
||||
timestamp=datetime.fromisoformat(info['timestamp']),
|
||||
edited_timestamp=datetime.fromisoformat(edited_timestamp) if edited_timestamp is not None else None,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue