@@ -752,7 +752,10 @@ async def on_message_edit_automatic_issue_link(self, before: disnake.Message, af
752752
753753 cached = self .autolink_cache .get (after .id )
754754 if cached is None :
755- return
755+ # Check if it was the most recent message sent in the channel, if so, go ahead and process it.
756+ if after .channel .last_message_id != after .id :
757+ return
758+ cached = (None , {})
756759
757760 app_permissions = after .channel .permissions_for (after .guild .me )
758761
@@ -777,7 +780,10 @@ async def on_message_edit_automatic_issue_link(self, before: disnake.Message, af
777780 color = responses .DEFAULT_FAILURE_COLOUR ,
778781 description = f"Too many issues/PRs! (maximum of { MAXIMUM_ISSUES } )" ,
779782 )
780- sent_message = await sent_message .edit (embed = embed )
783+ if sent_message is None :
784+ sent_message = await after .channel .send (embed = embed )
785+ else :
786+ sent_message = await sent_message .edit (embed = embed )
781787 self .autolink_cache .set (
782788 after .id ,
783789 (sent_message , matches ),
@@ -812,11 +818,19 @@ async def on_message_edit_automatic_issue_link(self, before: disnake.Message, af
812818 )
813819 )
814820 )
815- sent_message = await sent_message .edit (
816- ** data ,
817- components = components ,
818- allowed_mentions = disnake .AllowedMentions .none (),
819- )
821+ if sent_message is None :
822+ sent_message = await after .reply (
823+ ** data ,
824+ components = components ,
825+ fail_if_not_exists = False ,
826+ allowed_mentions = disnake .AllowedMentions .none (),
827+ )
828+ else :
829+ sent_message = await sent_message .edit (
830+ ** data ,
831+ components = components ,
832+ allowed_mentions = disnake .AllowedMentions .none (),
833+ )
820834
821835 # update the cache with the new matches
822836 self .autolink_cache .set (
0 commit comments