@@ -591,10 +591,16 @@ async def on_raw_reaction_add(self, payload: discord.RawReactionActionEvent):
591591 except Exception :
592592 return
593593
594- # Fetch channel and message
594+ # Fetch channel and message (ensure channel supports fetch_message)
595595 try :
596596 channel = self .bot .get_channel (payload .channel_id ) or await self .bot .fetch_channel (payload .channel_id )
597- message = await channel .fetch_message (payload .message_id )
597+ if not hasattr (channel , 'fetch_message' ):
598+ return
599+ # Cast to Messageable for type checkers
600+ from typing import cast
601+ from discord .abc import Messageable
602+ mchannel = cast (Messageable , channel )
603+ message = await mchannel .fetch_message (payload .message_id )
598604 except Exception :
599605 return
600606
@@ -649,7 +655,13 @@ async def on_raw_reaction_remove(self, payload: discord.RawReactionActionEvent):
649655
650656 try :
651657 channel = self .bot .get_channel (payload .channel_id ) or await self .bot .fetch_channel (payload .channel_id )
652- message = await channel .fetch_message (payload .message_id )
658+ if not hasattr (channel , 'fetch_message' ):
659+ return
660+ # Cast to Messageable for type checkers
661+ from typing import cast
662+ from discord .abc import Messageable
663+ mchannel = cast (Messageable , channel )
664+ message = await mchannel .fetch_message (payload .message_id )
653665 except Exception :
654666 return
655667
@@ -680,7 +692,7 @@ async def on_raw_reaction_remove(self, payload: discord.RawReactionActionEvent):
680692
681693 await self .handle_star_reaction (reaction_obj , user_obj , added = False )
682694
683- async def handle_star_reaction (self , reaction : discord . Reaction , user : discord . User , added : bool ):
695+ async def handle_star_reaction (self , reaction : Any , user : Any , added : bool ):
684696 """Process star reactions (add or remove)"""
685697 message = reaction .message
686698
0 commit comments