@@ -72,6 +72,8 @@ async def an_event_handler(event: ChannelCreate):
72
72
"MessageCreate" ,
73
73
"MessageDelete" ,
74
74
"MessageDeleteBulk" ,
75
+ "MessagePollVoteAdd" ,
76
+ "MessagePollVoteRemove" ,
75
77
"MessageReactionAdd" ,
76
78
"MessageReactionRemove" ,
77
79
"MessageReactionRemoveAll" ,
@@ -115,6 +117,7 @@ async def an_event_handler(event: ChannelCreate):
115
117
from interactions .models .discord .entitlement import Entitlement
116
118
from interactions .models .discord .guild import Guild , GuildIntegration
117
119
from interactions .models .discord .message import Message
120
+ from interactions .models .discord .poll import Poll
118
121
from interactions .models .discord .reaction import Reaction
119
122
from interactions .models .discord .role import Role
120
123
from interactions .models .discord .scheduled_event import ScheduledEvent
@@ -588,6 +591,72 @@ class MessageReactionRemoveEmoji(MessageReactionRemoveAll):
588
591
"""The emoji that was removed"""
589
592
590
593
594
+ @attrs .define (eq = False , order = False , hash = False , kw_only = False )
595
+ class BaseMessagePollEvent (BaseEvent ):
596
+ user_id : "Snowflake_Type" = attrs .field (repr = False )
597
+ """The ID of the user that voted"""
598
+ channel_id : "Snowflake_Type" = attrs .field (repr = False )
599
+ """The ID of the channel the poll is in"""
600
+ message_id : "Snowflake_Type" = attrs .field (repr = False )
601
+ """The ID of the message the poll is in"""
602
+ answer_id : int = attrs .field (repr = False )
603
+ """The ID of the answer the user voted for"""
604
+ guild_id : "Optional[Snowflake_Type]" = attrs .field (repr = False , default = None )
605
+ """The ID of the guild the poll is in"""
606
+
607
+ def get_message (self ) -> "Optional[Message]" :
608
+ """Get the message object if it is cached"""
609
+ return self .client .cache .get_message (self .channel_id , self .message_id )
610
+
611
+ def get_user (self ) -> "Optional[User]" :
612
+ """Get the user object if it is cached"""
613
+ return self .client .get_user (self .user_id )
614
+
615
+ def get_channel (self ) -> "Optional[TYPE_ALL_CHANNEL]" :
616
+ """Get the channel object if it is cached"""
617
+ return self .client .get_channel (self .channel_id )
618
+
619
+ def get_guild (self ) -> "Optional[Guild]" :
620
+ """Get the guild object if it is cached"""
621
+ return self .client .get_guild (self .guild_id ) if self .guild_id is not None else None
622
+
623
+ def get_poll (self ) -> "Optional[Poll]" :
624
+ """Get the poll object if it is cached"""
625
+ message = self .get_message ()
626
+ return message .poll if message is not None else None
627
+
628
+ async def fetch_message (self ) -> "Message" :
629
+ """Fetch the message the poll is in"""
630
+ return await self .client .cache .fetch_message (self .channel_id , self .message_id )
631
+
632
+ async def fetch_user (self ) -> "User" :
633
+ """Fetch the user that voted"""
634
+ return await self .client .fetch_user (self .user_id )
635
+
636
+ async def fetch_channel (self ) -> "TYPE_ALL_CHANNEL" :
637
+ """Fetch the channel the poll is in"""
638
+ return await self .client .fetch_channel (self .channel_id )
639
+
640
+ async def fetch_guild (self ) -> "Optional[Guild]" :
641
+ """Fetch the guild the poll is in"""
642
+ return await self .client .fetch_guild (self .guild_id ) if self .guild_id is not None else None
643
+
644
+ async def fetch_poll (self ) -> "Poll" :
645
+ """Fetch the poll object"""
646
+ message = await self .fetch_message ()
647
+ return message .poll
648
+
649
+
650
+ @attrs .define (eq = False , order = False , hash = False , kw_only = False )
651
+ class MessagePollVoteAdd (BaseMessagePollEvent ):
652
+ """Dispatched when a user votes in a poll"""
653
+
654
+
655
+ @attrs .define (eq = False , order = False , hash = False , kw_only = False )
656
+ class MessagePollVoteRemove (BaseMessagePollEvent ):
657
+ """Dispatched when a user remotes a votes in a poll"""
658
+
659
+
591
660
@attrs .define (eq = False , order = False , hash = False , kw_only = False )
592
661
class PresenceUpdate (BaseEvent ):
593
662
"""A user's presence has changed."""
0 commit comments