Skip to content

Commit

Permalink
✨ add log for message event
Browse files Browse the repository at this point in the history
  • Loading branch information
RF-Tar-Railt committed Jul 26, 2024
1 parent 57ce051 commit e1981ff
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions arclet/entari/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ def __init__(self, *configs: Config):
self.lifecycle(self.account_hook)
self._ref_tasks = set()

@self.on_message(priority=0)
def log(event: MessageEvent):
logger.info(
f"[{event.channel.name or event.channel.id}{f'({event.channel.id})' if event.channel.name else ''})] "
f"{event.member.nick if event.member else (event.user.name or event.user.id)}({event.user.id}) ->"
f" {event.message.content!r}"
)

def on(
self,
*events: type,
Expand Down

0 comments on commit e1981ff

Please sign in to comment.