Skip to content

Commit

Permalink
Filtering bot message
Browse files Browse the repository at this point in the history
  • Loading branch information
KOZ39 committed Mar 1, 2023
1 parent d0b1aea commit 682d103
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- Python 3.8+
- discord.py 1.7.3 or 2.0.0+

## Discord Developer Portal
## [Discord Developer Portal](https://discord.com/developers/applications)
Bot Permissions
- Send Messages
- Send Messages in Threads (Option)
Expand Down
6 changes: 2 additions & 4 deletions v173.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import os
import re
import traceback

import discord


EMOJI_REGEX = r"^<(a)?:(.+):([0-9]{15,21})>$"
EMOJI_REGEX = r"^<(a)?:(.+?):([0-9]{15,21})>$"

client = discord.Client()

Expand All @@ -17,7 +15,7 @@ async def on_ready() -> None:

@client.event
async def on_message(message: discord.Message) -> None:
if not message.guild:
if not message.guild and message.author.bot:
return

if (m := re.match(EMOJI_REGEX, message.content)):
Expand Down
6 changes: 2 additions & 4 deletions v200.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import os
import re
import traceback

import discord


EMOJI_REGEX = r"^<(a)?:(.+):([0-9]{15,21})>$"
EMOJI_REGEX = r"^<(a)?:(.+?):([0-9]{15,21})>$"

intents = discord.Intents.default()
intents.message_content = True
Expand All @@ -20,7 +18,7 @@ async def on_ready() -> None:

@client.event
async def on_message(message: discord.Message) -> None:
if not message.guild:
if not message.guild and message.author.bot:
return

if (m := re.match(EMOJI_REGEX, message.content)):
Expand Down

0 comments on commit 682d103

Please sign in to comment.