Skip to content

Commit aca0eef

Browse files
committed
Creation of spam module
1 parent 74d97b0 commit aca0eef

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

tg_bot/modules/global_bans.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def gban(bot: Bot, update: Update, args: List[str]):
5959
return
6060

6161
if int(user_id) in SUPPORT_USERS:
62-
message.reply_text("OOOH qualcuno sta cercando di efffettuare un gban ad un support user! *grabs popcorn*")
62+
message.reply_text("OOOH qualcuno sta cercando di effettuare un gban ad un support user! *grabs popcorn*")
6363
return
6464

6565
if user_id == bot.id:

tg_bot/modules/spam.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from tg_bot import dispatcher, LOGGER
2+
from telegram import Update, Bot
3+
from telegram.ext import MessageHandler, Filters
4+
5+
6+
def spam_filter(bot: Bot, update: Update):
7+
msg = update.effective_message.text
8+
LOGGER.debug("spam" in msg)
9+
if msg and "spam" in msg:
10+
user = update.effective_user.username
11+
update.effective_message.reply_text(f"Non spammare! @{user}", quote=False)
12+
update.effective_message.delete()
13+
14+
15+
SPAM_HANDLER = MessageHandler(Filters.all & Filters.group, spam_filter)
16+
17+
dispatcher.add_handler(SPAM_HANDLER)

0 commit comments

Comments
 (0)