Skip to content

Commit e801ecd

Browse files
author
root
committed
added message.mentions_bot
1 parent 3f2de0e commit e801ecd

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

discord/message.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1844,6 +1844,14 @@ def _handle_mention_roles(self, role_mentions: List[int]) -> None:
18441844
if role is not None:
18451845
self.role_mentions.append(role)
18461846

1847+
def mentions_bot(self,strict:Optional[bool]=False):
1848+
if strict == True:
1849+
if self.content == f"<@{self.guild.me.id}>" or self.content == f"<@!{self.guild.me.id}>": return True
1850+
return False
1851+
else:
1852+
if f"<@{self.guild.me.id}>" in self.content or f"<@!{self.guild.me.id}>" in self.content: return True
1853+
return False
1854+
18471855
def invites(self):
18481856
DISCORD_INVITE = r'(?:https?://)?(?:www.:?)?discord(?:(?:app)?.com/invite|.gg)/?[a-zA-Z0-9]+/?'
18491857
DSG = r'(https|http)://(dsc.gg|discord.gg|discord.io|dsc.lol)/?[\S]+/?'

0 commit comments

Comments
 (0)