Ignore all forwarded messages

this was a feature, not a bug but https://t.me/friendlytgbot/24
This commit is contained in:
blank X 2021-01-29 22:01:52 +07:00
parent e299639ae6
commit 65e5f328c2
20 changed files with 26 additions and 26 deletions

View File

@ -25,7 +25,7 @@ def _generate_sexy(entity, ping):
sexy_text += ' <code>[SCAM]</code>' sexy_text += ' <code>[SCAM]</code>'
return sexy_text return sexy_text
@Client.on_message(~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command(['admin', 'admins'], prefixes=config['config']['prefixes'])) @Client.on_message(~filters.forwarded & ~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command(['admin', 'admins'], prefixes=config['config']['prefixes']))
@log_errors @log_errors
@public_log_errors @public_log_errors
async def admins(client, message): async def admins(client, message):

View File

@ -4,7 +4,7 @@ from pyrogram.types.messages_and_media import Photo
from pyrogram.errors.exceptions.forbidden_403 import Forbidden from pyrogram.errors.exceptions.forbidden_403 import Forbidden
from .. import slave, config, help_dict, log_errors, public_log_errors from .. import slave, config, help_dict, log_errors, public_log_errors
@Client.on_message(~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command(['anilist', 'al', 'alc', 'alchar', 'alcharacter', 'anilistc', 'anilistchar', 'anilistcharacter'], prefixes=config['config']['prefixes'])) @Client.on_message(~filters.forwarded & ~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command(['anilist', 'al', 'alc', 'alchar', 'alcharacter', 'anilistc', 'anilistchar', 'anilistcharacter'], prefixes=config['config']['prefixes']))
@log_errors @log_errors
@public_log_errors @public_log_errors
async def anilist(client, message): async def anilist(client, message):

View File

@ -4,7 +4,7 @@ import tempfile
from pyrogram import Client, filters from pyrogram import Client, filters
from .. import config, help_dict, log_errors, session, progress_callback, public_log_errors from .. import config, help_dict, log_errors, session, progress_callback, public_log_errors
@Client.on_message(~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command('cat', prefixes=config['config']['prefixes'])) @Client.on_message(~filters.forwarded & ~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command('cat', prefixes=config['config']['prefixes']))
@log_errors @log_errors
@public_log_errors @public_log_errors
async def cat(client, message): async def cat(client, message):

View File

@ -3,7 +3,7 @@ import asyncio
from pyrogram import Client, filters from pyrogram import Client, filters
from .. import config, help_dict, log_errors, public_log_errors from .. import config, help_dict, log_errors, public_log_errors
@Client.on_message(~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command(['d', 'del', 'delete'], prefixes=config['config']['prefixes'])) @Client.on_message(~filters.forwarded & ~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command(['d', 'del', 'delete'], prefixes=config['config']['prefixes']))
@log_errors @log_errors
@public_log_errors @public_log_errors
async def delete(client, message): async def delete(client, message):
@ -18,7 +18,7 @@ async def delete(client, message):
break break
await client.delete_messages(message.chat.id, messages) await client.delete_messages(message.chat.id, messages)
@Client.on_message(~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command(['p', 'purge', 'sp', 'selfpurge'], prefixes=config['config']['prefixes'])) @Client.on_message(~filters.forwarded & ~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command(['p', 'purge', 'sp', 'selfpurge'], prefixes=config['config']['prefixes']))
@log_errors @log_errors
@public_log_errors @public_log_errors
async def purge(client, message): async def purge(client, message):
@ -51,7 +51,7 @@ async def purge(client, message):
yeetpurge_info = {True: dict(), False: dict()} yeetpurge_info = {True: dict(), False: dict()}
yeetpurge_lock = asyncio.Lock() yeetpurge_lock = asyncio.Lock()
@Client.on_message(~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command(['yp', 'yeetpurge', 'syp', 'selfyeetpurge'], prefixes=config['config']['prefixes'])) @Client.on_message(~filters.forwarded & ~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command(['yp', 'yeetpurge', 'syp', 'selfyeetpurge'], prefixes=config['config']['prefixes']))
@log_errors @log_errors
@public_log_errors @public_log_errors
async def yeetpurge(client, message): async def yeetpurge(client, message):

View File

@ -49,7 +49,7 @@ DEAI_MODULE_CODES = {
"8": "Codename Gestapo" "8": "Codename Gestapo"
} }
@Client.on_message(~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command(['einfo', 'externalinfo', 'sw', 'spamwatch', 'deai', 'spb', 'spamprotection', 'cas', 'combot', 'rose'], prefixes=config['config']['prefixes'])) @Client.on_message(~filters.forwarded & ~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command(['einfo', 'externalinfo', 'sw', 'spamwatch', 'deai', 'spb', 'spamprotection', 'cas', 'combot', 'rose'], prefixes=config['config']['prefixes']))
@log_errors @log_errors
@public_log_errors @public_log_errors
async def fedstat(client, message): async def fedstat(client, message):
@ -198,7 +198,7 @@ async def get_spam_protection(entity):
return text return text
return f'- <b>{json["response_code"]}</b>: {json["error"]["error_code"]}: {json["error"]["type"]}: {html.escape(json["error"]["message"])}' return f'- <b>{json["response_code"]}</b>: {json["error"]["error_code"]}: {json["error"]["type"]}: {html.escape(json["error"]["message"])}'
@Client.on_message(~filters.sticker & ~filters.via_bot & ~filters.edited & filters.chat(['rsophiebot', 'missrose_bot']) & filters.incoming & filters.regex('^Federation ban info:\n|You aren\'t fbanned in this fed\.|^Failed to get user: unable to getChatMember: Bad Request: chat not found$|^.+ is not banned in this fed\.$|^.+ is currently banned in Rose Support Official, for the following reason:\n\n')) @Client.on_message(~filters.forwarded & ~filters.sticker & ~filters.via_bot & ~filters.edited & filters.chat(['rsophiebot', 'missrose_bot']) & filters.incoming & filters.regex('^Federation ban info:\n|You aren\'t fbanned in this fed\.|^Failed to get user: unable to getChatMember: Bad Request: chat not found$|^.+ is not banned in this fed\.$|^.+ is currently banned in Rose Support Official, for the following reason:\n\n'))
async def fedstat_conversation_hack(client, message): async def fedstat_conversation_hack(client, message):
reply = message.reply_to_message reply = message.reply_to_message
if not getattr(reply, 'empty', True): if not getattr(reply, 'empty', True):

View File

@ -4,7 +4,7 @@ from pyrogram import Client, filters
from pyrogram.errors.exceptions.bad_request_400 import MessageIdInvalid from pyrogram.errors.exceptions.bad_request_400 import MessageIdInvalid
from .. import config, help_dict, log_errors, session, progress_callback, public_log_errors from .. import config, help_dict, log_errors, session, progress_callback, public_log_errors
@Client.on_message(~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command(['ls', 'hls', 'hiddenls'], prefixes=config['config']['prefixes'])) @Client.on_message(~filters.forwarded & ~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command(['ls', 'hls', 'hiddenls'], prefixes=config['config']['prefixes']))
@log_errors @log_errors
@public_log_errors @public_log_errors
async def ls(client, message): async def ls(client, message):
@ -28,7 +28,7 @@ async def ls(client, message):
text += f'<code>{html.escape(i)}</code>\n' text += f'<code>{html.escape(i)}</code>\n'
await message.reply_text(text or 'Empty', disable_web_page_preview=True) await message.reply_text(text or 'Empty', disable_web_page_preview=True)
@Client.on_message(~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command(['ul', 'upload'], prefixes=config['config']['prefixes'])) @Client.on_message(~filters.forwarded & ~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command(['ul', 'upload'], prefixes=config['config']['prefixes']))
@log_errors @log_errors
@public_log_errors @public_log_errors
async def upload(client, message): async def upload(client, message):
@ -44,7 +44,7 @@ async def upload(client, message):
else: else:
await reply.delete() await reply.delete()
@Client.on_message(~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command(['dl', 'download'], prefixes=config['config']['prefixes'])) @Client.on_message(~filters.forwarded & ~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command(['dl', 'download'], prefixes=config['config']['prefixes']))
@log_errors @log_errors
@public_log_errors @public_log_errors
async def download(client, message): async def download(client, message):

View File

@ -3,7 +3,7 @@ from pyrogram import Client, filters
from pyrogram.errors.exceptions.forbidden_403 import Forbidden from pyrogram.errors.exceptions.forbidden_403 import Forbidden
from .. import slave, config, help_dict, log_errors, public_log_errors from .. import slave, config, help_dict, log_errors, public_log_errors
@Client.on_message(~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command('help', prefixes=config['config']['prefixes'])) @Client.on_message(~filters.forwarded & ~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command('help', prefixes=config['config']['prefixes']))
@log_errors @log_errors
@public_log_errors @public_log_errors
async def help(client, message): async def help(client, message):

View File

@ -27,7 +27,7 @@ def _generate_sexy(entity, ping):
sexy_text += ' <code>[SCAM]</code>' sexy_text += ' <code>[SCAM]</code>'
return sexy_text return sexy_text
@Client.on_message(~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command(['info', 'whois'], prefixes=config['config']['prefixes'])) @Client.on_message(~filters.forwarded & ~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command(['info', 'whois'], prefixes=config['config']['prefixes']))
@log_errors @log_errors
@public_log_errors @public_log_errors
async def info(client, message): async def info(client, message):
@ -69,7 +69,7 @@ async def info(client, message):
except MessageNotModified: except MessageNotModified:
pass pass
@Client.on_message(~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command('id', prefixes=config['config']['prefixes'])) @Client.on_message(~filters.forwarded & ~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command('id', prefixes=config['config']['prefixes']))
@log_errors @log_errors
@public_log_errors @public_log_errors
async def id(client, message): async def id(client, message):

View File

@ -7,7 +7,7 @@ from .. import config, slave, log_errors, app_user_ids
logged = set() logged = set()
lock = asyncio.Lock() lock = asyncio.Lock()
@Client.on_message(~filters.chat(config['config']['log_chat']) & filters.incoming & filters.forwarded & (filters.group | filters.channel)) @Client.on_message(~filters.forwarded & ~filters.chat(config['config']['log_chat']) & filters.incoming & filters.forwarded & (filters.group | filters.channel))
@log_errors @log_errors
async def log_forwards(client, message): async def log_forwards(client, message):
if not config['config'].get('log_forwards'): if not config['config'].get('log_forwards'):

View File

@ -7,7 +7,7 @@ from .. import config, slave, log_errors
reported = set() reported = set()
lock = asyncio.Lock() lock = asyncio.Lock()
@Client.on_message(~filters.chat(config['config']['log_chat']) & filters.regex(r'(?:^|\s+)@admins?(?:$|\W+)|^[/!](?:report|admins?)(?:$|\W+)') & filters.group) @Client.on_message(~filters.forwarded & ~filters.chat(config['config']['log_chat']) & filters.regex(r'(?:^|\s+)@admins?(?:$|\W+)|^[/!](?:report|admins?)(?:$|\W+)') & filters.group)
@log_errors @log_errors
async def log_reports(client, message): async def log_reports(client, message):
if not config['config']['log_reports']: if not config['config']['log_reports']:

View File

@ -9,7 +9,7 @@ from .. import config, help_dict, log_errors, session, slave, public_log_errors
help_text = '' help_text = ''
def _generate(i): def _generate(i):
@Client.on_message(~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command(i, prefixes=config['config']['prefixes'])) @Client.on_message(~filters.forwarded & ~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command(i, prefixes=config['config']['prefixes']))
@log_errors @log_errors
@public_log_errors @public_log_errors
async def func(client, message): async def func(client, message):

View File

@ -2,7 +2,7 @@ import time
from pyrogram import Client, filters from pyrogram import Client, filters
from .. import config, help_dict, log_errors, public_log_errors from .. import config, help_dict, log_errors, public_log_errors
@Client.on_message(~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command(['ping', 'pong'], prefixes=config['config']['prefixes'])) @Client.on_message(~filters.forwarded & ~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command(['ping', 'pong'], prefixes=config['config']['prefixes']))
@log_errors @log_errors
@public_log_errors @public_log_errors
async def ping_pong(client, message): async def ping_pong(client, message):

View File

@ -3,7 +3,7 @@ import signal
from pyrogram import Client, filters from pyrogram import Client, filters
from .. import config, help_dict, log_errors, public_log_errors from .. import config, help_dict, log_errors, public_log_errors
@Client.on_message(~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command(['poweroff', 'shutdown', 'stop'], prefixes=config['config']['prefixes'])) @Client.on_message(~filters.forwarded & ~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command(['poweroff', 'shutdown', 'stop'], prefixes=config['config']['prefixes']))
@log_errors @log_errors
@public_log_errors @public_log_errors
async def poweroff(client, message): async def poweroff(client, message):

View File

@ -10,7 +10,7 @@ from pyrogram import Client, filters
from .. import config, help_dict, log_errors, slave, apps, session, public_log_errors from .. import config, help_dict, log_errors, slave, apps, session, public_log_errors
PYEXEC_REGEX = '^(?:' + '|'.join(map(re.escape, config['config']['prefixes'])) + r')exec\s+([\s\S]+)$' PYEXEC_REGEX = '^(?:' + '|'.join(map(re.escape, config['config']['prefixes'])) + r')exec\s+([\s\S]+)$'
@Client.on_message(~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.regex(PYEXEC_REGEX)) @Client.on_message(~filters.forwarded & ~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.regex(PYEXEC_REGEX))
@log_errors @log_errors
@public_log_errors @public_log_errors
async def pyexec(client, message): async def pyexec(client, message):

View File

@ -23,7 +23,7 @@ async def download_file(url, filename, referer=None):
return True return True
file.write(chunk) file.write(chunk)
@Client.on_message(~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command(['saucenao', 'sauce'], prefixes=config['config']['prefixes'])) @Client.on_message(~filters.forwarded & ~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command(['saucenao', 'sauce'], prefixes=config['config']['prefixes']))
@log_errors @log_errors
@public_log_errors @public_log_errors
async def saucenao(client, message): async def saucenao(client, message):

View File

@ -6,7 +6,7 @@ from pyrogram import Client, filters
from .. import config, help_dict, log_errors, public_log_errors from .. import config, help_dict, log_errors, public_log_errors
SHELL_REGEX = '^(?:' + '|'.join(map(re.escape, config['config']['prefixes'])) + r')(?:(?:ba)?sh|shell|term(?:inal)?)\s+(.+)(?:\n([\s\S]+))?$' SHELL_REGEX = '^(?:' + '|'.join(map(re.escape, config['config']['prefixes'])) + r')(?:(?:ba)?sh|shell|term(?:inal)?)\s+(.+)(?:\n([\s\S]+))?$'
@Client.on_message(~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.regex(SHELL_REGEX)) @Client.on_message(~filters.forwarded & ~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.regex(SHELL_REGEX))
@log_errors @log_errors
@public_log_errors @public_log_errors
async def shell(client, message): async def shell(client, message):

View File

@ -7,7 +7,7 @@ from .. import config, help_dict, log_errors, public_log_errors
PROBLEM_CODES = set(i for i in googletrans.LANGUAGES if '-' in i) PROBLEM_CODES = set(i for i in googletrans.LANGUAGES if '-' in i)
ZWS = '\u200B' ZWS = '\u200B'
@Client.on_message(~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command(['tr', 'translate'], prefixes=config['config']['prefixes'])) @Client.on_message(~filters.forwarded & ~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command(['tr', 'translate'], prefixes=config['config']['prefixes']))
@log_errors @log_errors
@public_log_errors @public_log_errors
async def translate(client, message): async def translate(client, message):

View File

@ -2,7 +2,7 @@ from pyrogram import Client, filters
from pyrogram.errors.exceptions.forbidden_403 import Forbidden from pyrogram.errors.exceptions.forbidden_403 import Forbidden
from .. import slave, config, help_dict, log_errors, public_log_errors from .. import slave, config, help_dict, log_errors, public_log_errors
@Client.on_message(~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command(['ud', 'urbandictionary'], prefixes=config['config']['prefixes'])) @Client.on_message(~filters.forwarded & ~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command(['ud', 'urbandictionary'], prefixes=config['config']['prefixes']))
@log_errors @log_errors
@public_log_errors @public_log_errors
async def ud(client, message): async def ud(client, message):

View File

@ -10,7 +10,7 @@ from pyrogram import Client, filters
from pyrogram.types import Sticker from pyrogram.types import Sticker
from .. import config, help_dict, log_errors, session, progress_callback, public_log_errors from .. import config, help_dict, log_errors, session, progress_callback, public_log_errors
@Client.on_message(~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command(['trace', 'tracemoe', 'whatanime', 'wa', 'wait'], prefixes=config['config']['prefixes'])) @Client.on_message(~filters.forwarded & ~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command(['trace', 'tracemoe', 'whatanime', 'wa', 'wait'], prefixes=config['config']['prefixes']))
@log_errors @log_errors
@public_log_errors @public_log_errors
async def whatanime(client, message): async def whatanime(client, message):

View File

@ -2,7 +2,7 @@ from pyrogram import Client, filters
from pyrogram.errors.exceptions.forbidden_403 import Forbidden from pyrogram.errors.exceptions.forbidden_403 import Forbidden
from .. import slave, config, help_dict, log_errors, public_log_errors from .. import slave, config, help_dict, log_errors, public_log_errors
@Client.on_message(~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command(['w', 'wiki', 'wikipedia'], prefixes=config['config']['prefixes'])) @Client.on_message(~filters.forwarded & ~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command(['w', 'wiki', 'wikipedia'], prefixes=config['config']['prefixes']))
@log_errors @log_errors
@public_log_errors @public_log_errors
async def wikipedia(client, message): async def wikipedia(client, message):