Skip to content

Commit

Permalink
✨ InteractionCreateEvent add get_user_id
Browse files Browse the repository at this point in the history
  • Loading branch information
CMHopeSunshine authored Apr 14, 2024
1 parent 19b336f commit 19795ef
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions nonebot/adapters/discord/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,12 @@ class InteractionCreateEvent(NoticeEvent, InteractionCreate):

__type__ = EventType.INTERACTION_CREATE

@override
def get_user_id(self) -> str:
if not self.user:
raise ValueError("Event has no context!")
return str(self.user.id)


class PingInteractionEvent(InteractionCreateEvent):
type: Literal[InteractionType.PING]
Expand Down

0 comments on commit 19795ef

Please sign in to comment.