diff --git a/README.md b/README.md index 5811842..16219d2 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,7 @@ # Blue Moon Vampire Bot -> An Telegram Antispam Based Bot . - -## A Pyogram Bot to make banned, report easy -> Based Sylviorus Api +> A Pyrogram UBot to make gbanning easy ## Installing Vars ``` @@ -13,11 +10,12 @@ [-] APP_ID: You can get this value from https://my.telegram.org [-] APP_HASH : You can get this value from https://my.telegram.org [-] MONGO_URI : Your Mongo DB DataBase Url. . - [-] BOT_TOKEN: Get from botfarther + [-] SESSION: Get YOUR ID SESSION [-] SYL_TOKEN: Get from @BlueMoonVampireBot Only Dev [-] DEVS: Enter Dev Id [-] LOGS: Log Channel Id [-] REPORT_LOGS: Log Report Channel Id + [-] GBAN_LOGS: Log GBAN group Id ``` # Deploy diff --git a/app/__init__.py b/app/__init__.py index 9f9edba..3745aa2 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -22,16 +22,15 @@ """ from pyrogram import Client -from config import API_ID, API_HASH, BOT_TOKEN, SYLTOKEN +from config import API_ID, API_HASH, SESSION from .utils import Sylviorus from .db import LocalDb -bot = Client("Sylviorus", - api_id=API_ID, - api_hash=API_HASH, - bot_token=BOT_TOKEN, - plugins=dict(root="{}/plugins".format(__name__))) - +bot = Client( + session_name=SESSION, + api_id=API_ID, + api_hash=API_HASH, + plugins=dict(root="{}/plugins".format(__name__)) +) ldb = LocalDb("reasons") -SYL = Sylviorus(SYLTOKEN) diff --git a/app/plugins/ban.py b/app/plugins/ban.py index 3b21540..3187974 100644 --- a/app/plugins/ban.py +++ b/app/plugins/ban.py @@ -22,8 +22,7 @@ """ from app import SYL, bot -from app import app -from config import LOGS, DEVS +from config import LOGS, DEVS, GBAN_LOGS from app.utils import * from pyrogram import filters from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup @@ -32,7 +31,7 @@ from pyrogram.types import Message -@bot.on_message(filters.command("sylban", prefixes=["/", ".", "?", "-"])) +@bot.on_message(filters.command("scan", prefixes=["/", ".", "?", "-"])) async def ban(Client, m: Message): if not m.from_user.id in DEVS: await m.reply_text("Only The Vampire of Blue moon Can Use Me") @@ -52,19 +51,13 @@ async def ban(Client, m: Message): else: user = int(user) - if user not in DEVS: - x = SYL.ban(user, reason, enforcer) - buttons = [ - [ - InlineKeyboardButton( - "Support", url="https://t.me/Sylviorus_support") - ], - [ - InlineKeyboardButton( - "Report", url="https://t.me/SylviorusReport") - ], - ] - + if user not in DEVS: + await bot.send_message( + GBAN_LOGS, + f"""/fban {user} {reason} //by {enforce}""") + await bot.send_message( + GBAN_LOGS, + f"""/gban {user} {reason} //by {enforce}""") await bot.send_message( LOGS, f""" @@ -73,9 +66,7 @@ async def ban(Client, m: Message): **REASON**: {reason} **ENFORCER**: [{enforcer}](tg://user?id={enforcer}) **CHAT_ID** : {m.chat.id} -""", - reply_markup=InlineKeyboardMarkup(buttons)) - await m.reply(x) +""") else: await m.reply("Vampires Cant Be Banned!") @@ -86,15 +77,10 @@ async def ban(Client, m: Message): if not user in DEVS: user = int(user) - buttons = [[ - InlineKeyboardButton("Support", - url="https://t.me/Sylviorus_support"), - ], - [ - InlineKeyboardButton( - "Report", url="https://t.me/SylviorusReport"), - ]] - x = SYL.ban(user, reason, enforcer) + await bot.send_message(GBAN_LOGS, + f"""/gban {user} {reason} //by {enforce}""") + await bot.send_message(GBAN_LOGS, + f"""/fban {user} {reason} //by {enforce}""") await bot.send_message(LOGS, f""" #BANNED @@ -104,9 +90,7 @@ async def ban(Client, m: Message): **ENFORCER**: [{enforcer}](tg://user?id={enforcer}) **CHAT_ID** : {m.chat.id} **Message Link : {m.link} -""", - reply_markup=InlineKeyboardMarkup(buttons)) - await m.reply(x) +""") else: await m.reply("The Vampire of Blue moon can't be banned!") diff --git a/app/plugins/check.py b/app/plugins/check.py deleted file mode 100644 index ef06894..0000000 --- a/app/plugins/check.py +++ /dev/null @@ -1,71 +0,0 @@ -""" -MIT License -Copyright (C) 2021-2022, NkSama -Copyright (C) 2021-2022 Moezilla -Copyright (c) 2021, Sylviorus, -This file is part of @BlueMoonVampireBot (Antispam Telegram Bot) -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -""" - -from app import bot, SYL -from app.utils import check_dev, -from config import LOGS, DEVS -from app.utils import * -from pyrogram.types import Message -from pyrogram import filters, Client - - -@bot.on_message(filters.command("check", ['/', ".", "?"])) -async def check(bot: Client, m: Message): - if not m.reply_to_message: - user = m.command[1] - if not user.isdigit(): - await m.reply_text("User ID Must Be Integer") - return - - else: - user = int(user) - if user in DEVS: - m.reply("This User Is My Captain") - - else: - x = SYL.check(user) - if x['blacklisted']: - await m.reply(f""" -#CHECK - -**USER** : [{user}](tg://user?id={user}) -**REASON** : {x["reason"]} -**ENFORCER** : [{x["enforcer"]}](tg://user?id={x["enforcer"]}) - """.strip()) - else: - await m.reply("This User Is Not Blacklisted") - - if m.reply_to_message: - user = m.reply_to_message.from_user.id - - if user in DEVS: - await m.reply("This User Is My Captain") - - else: - x = SYL.check(user) - await m.reply(f""" -#CHECK - -**USER** : [{user}](tg://user?id={user}) -**REASON** : {x["reason"]} -**ENFORCER** : [{x["enforcer"]}](tg://user?id={x["enforcer"]}""".strip()) diff --git a/app/plugins/extra.py b/app/plugins/extra.py deleted file mode 100644 index 0e18e3f..0000000 --- a/app/plugins/extra.py +++ /dev/null @@ -1,85 +0,0 @@ -""" -MIT License -Copyright (C) 2021-2022, NkSama -Copyright (C) 2021-2022 Moezilla -Copyright (c) 2021, Sylviorus, -This file is part of @BlueMoonVampireBot (Antispam Telegram Bot) -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -""" - -from .. import bot -from config import DEVS -from pyrogram import filters -from pyrogram.types import Message, InlineKeyboardButton, InlineKeyboardMarkup, CallbackQuery -from requests import get, post -from subprocess import getoutput as run - - -def paste(text): - url = "https://spaceb.in/api/v1/documents/" - res = post(url, data={"content": text, "extension": "txt"}) - return f"https://spaceb.in/{res.json()['payload']['id']}" - - -@bot.on_message( - filters.command("logs", prefixes=['.', '/', ';', ',' - '*']) & filters.user(DEVS)) -def sendlogs(_, m: Message): - logs = run("tail logs.txt") - x = paste(logs) - keyb = [ - [ - InlineKeyboardButton("SpaceBin", url=x), - InlineKeyboardButton("Send", callback_data="sendfile") - ], - ] - m.reply(x, - disable_web_page_preview=True, - reply_markup=InlineKeyboardMarkup(keyb)) - - -@bot.on_callback_query(filters.regex(r"sendfile")) -def sendfilecallback(_, query: CallbackQuery): - sender = query.from_user.id - chat = query.message.chat.id - - if sender in DEVS: - query.message.edit("Sending Logs file..") - query.message.reply_document("logs.txt") - - else: - query.answer("Only Devs can use me") - - -@bot.on_message(filters.command("id", prefixes=['.', "/", "?", ";"])) -def tg_id(_, m: Message): - if m.reply_to_message: - user = m.reply_to_message.from_user.id - info = bot.get_users(user) - m.reply_text( - f"**{info.first_name}'s** Id : ```{info.id}```\n**Your Id** : ```{m.from_user.id}```\n**Chat Id** : ```{m.chat.id}```" - ) - - elif len(m.command) == 2: - user = m.command[1] - info = bot.get_users(user) - m.reply_text( - f"**{info.first_name}'s** Id : ```{info.id}```\n**Your Id** : ```{m.from_user.id}```\n**Chat Id** : ```{m.chat.id}```" - ) - - else: - m.reply("Invalid Syntax") diff --git a/app/plugins/gscan.py b/app/plugins/gscan.py index cdb9ece..edba55c 100644 --- a/app/plugins/gscan.py +++ b/app/plugins/gscan.py @@ -22,9 +22,8 @@ """ from app import SYL, bot -from app import app from app.utils import * -from config import DEVS, LOGS +from config import DEVS, LOGS, GBAN_LOGS from pyrogram import filters from pyrogram.errors import FloodWait from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup @@ -50,17 +49,12 @@ async def gscan(bot: Client, m: Message): await m.reply("Banning....") for x in users: try: - SYL.ban(x, "Mass Adder MSG_ID : {}".format(m.message_id), - m.from_user.id) - buttons = [[ - InlineKeyboardButton("Support", - url="https://t.me/Sylviorus_support"), - ], - [ - InlineKeyboardButton( - "Report", - url="https://t.me/SylviorusReport"), - ]] + await bot.send_message( + GBAN_LOGS, + f"""/fban {x} MASS ADDING For @{grp} //by m.from_user.id""" + await bot.send_message( + GBAN_LOGS, + f"""/gban {x} MASS ADDING For @{grp} //by m.from_user.id""") await bot.send_message( LOGS, f""" @@ -70,8 +64,8 @@ async def gscan(bot: Client, m: Message): **REASON**: MASS ADDING For @{grp} **ENFORCER** : [{m.from_user.id}](tg://user?id={m.from_user.id}) **CHAT_ID** : {m.chat.id} -""", - reply_markup=InlineKeyboardMarkup(buttons)) +""") + time.sleep(1) except Exception as e: await i.edit(f"{e}") diff --git a/app/plugins/help.py b/app/plugins/help.py index 396268f..1b9e7cb 100644 --- a/app/plugins/help.py +++ b/app/plugins/help.py @@ -34,14 +34,13 @@ /start - __Start Mesasage__ /help - __Help Message__ -/check userid or reply to user - __Check User__ /setrole - __Roles Name__ -/sylreport - __Report Message__ +/report - __Report Message__ **Clan Of BlueMoon Commands**: -/sylban userid __reason or reply to user__ - __Ban User__ -/sylunban userid - __Unban User__ +/scan userid __reason or reply to user__ - __Ban User__ +/unscan userid - __Unban User__ /gscan Username - __All Group Admin Ban__ /ungscan Username - __All Group Admin Unban__ """ @@ -49,9 +48,4 @@ @bot.on_message(filters.command("help", ['/', ".", "?"])) async def help(bot, m): - await m.reply(HELP_TEXT, - parse_mode="markdown", - reply_markup=InlineKeyboardButton([[ - InlineKeyboardButton( - "Support", url="https://t.me/sylviorus_support") - ]])) + await m.reply(HELP_TEXT) diff --git a/app/plugins/notife.py b/app/plugins/notife.py deleted file mode 100644 index 2e9af0a..0000000 --- a/app/plugins/notife.py +++ /dev/null @@ -1,48 +0,0 @@ -""" -MIT License -Copyright (C) 2021-2022, NkSama -Copyright (C) 2021-2022 Moezilla -Copyright (c) 2021, Sylviorus, -This file is part of @BlueMoonVampireBot (Antispam Telegram Bot) -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -""" - - -from pyrogram import filters -from .. import bot -from requests import get -from ..utils import * -from config import DEVS -from pyrogram.types import Message - - -def is_blacklisted(user): - res = get("https://sylviorus-api.up.railway.app/user/" + str(user)).json() - return True if res['blacklisted'] else False - - -@bot.on_message(filters.new_chat_members) -def notify(_, m: Message): - user = m.from_user.id - if user in DEVS: - m.reply("Welcome Dev {}".format(m.from_user.first_name)) - - elif is_blacklisted(user): - m.reply("This User Is Blacklisted!") - - else: - pass diff --git a/app/plugins/report.py b/app/plugins/report.py index 25744be..e60884e 100644 --- a/app/plugins/report.py +++ b/app/plugins/report.py @@ -36,7 +36,7 @@ def paste(text): return f"{res.json()['payload']['id']}" -@bot.on_message(filters.command("sylreport")) +@bot.on_message(filters.command("report")) def report(_, m: Message): try: if m.reply_to_message and m.reply_to_message.from_user.id not in DEVS: @@ -45,13 +45,6 @@ def report(_, m: Message): reason = m.text.replace(m.text.split(" ")[0], "") x = m.reply_to_message.forward(-1001774528355) enforcer = m.from_user.id - keyb = [] - keyb.append([ - InlineKeyboardButton("BAN", - callback_data=f"bam:accept:{user}:"), - InlineKeyboardButton("UNBAN", - callback_data=f"bam:reject:{user}") - ]) ldb.add_reason(user, reason) bot.send_message(REPORT_LOGS, f""" @@ -62,62 +55,9 @@ def report(_, m: Message): **Message** : {m.reply_to_message.text} **Chat Username** : {m.chat.username} **Reason** : {reason} - """, - reply_markup=InlineKeyboardMarkup(keyb)) - + """) except Exception as e: m.reply(f"{e}") if m.reply_to_message.from_user.id in DEVS: m.reply("Vampire of the Blue moon Cant Be Reported!") - - -@bot.on_callback_query(filters.regex(r'bam')) -def bam_callback(_, query: CallbackQuery): - data = query.data.split(":") - if data[1] == "accept" and query.from_user.id in DEVS: - user = int(data[2]) - msg = ldb.get_reason(str(user)) - SYL.ban(user, msg, query.from_user.id) - buttons = [[ - InlineKeyboardButton("Support", - url="https://t.me/Sylviorus_support"), - ], - [ - InlineKeyboardButton( - "Report", url="https://t.me/SylviorusReport"), - ]] - bot.send_message(LOGS, - f""" -#BANNED - -**USER** : [{user}](tg://user?id={user}) -**ENFORCER** : [{query.from_user.id}](tg://user?id={query.from_user.id}) -**REASON** : {msg} -**CHAT_ID** : {query.message.chat.id} -""", - reply_markup=InlineKeyboardMarkup(buttons)) - - elif data[1] == "reject" and query.from_user.id in DEVS: - user = int(data[2]) - buttons = [[ - InlineKeyboardButton("Support", - url="https://t.me/Sylviorus_support"), - ], - [ - InlineKeyboardButton( - "Report", url="https://t.me/SylviorusReport"), - ]] - SYL.unban(user) - bot.send_message(LOGS, - f""" -#UNBANNED - -**USER** : [{user}](tg://user?id={user}) -**ENFORCER** : [{query.from_user.id}](tg://user?id={query.from_user.id}) -**CHAT_ID** : {query.message.chat.id} -""", - reply_markup=InlineKeyboardMarkup(buttons)) - - if not query.from_user.id in DEVS: - query.answer("You are not Vampire of The Blue Moon") diff --git a/app/plugins/start.py b/app/plugins/start.py index 10d407f..e8b9298 100644 --- a/app/plugins/start.py +++ b/app/plugins/start.py @@ -35,8 +35,4 @@ @bot.on_message(filters.command(["start"], ['/', ".", "?"])) async def start(client, message): - buttons = [[ - InlineKeyboardButton("Support", url="https://t.me/Sylviorus_support"), - ]] - await message.reply_text(sylmessage.format(message.from_user.first_name), - reply_markup=InlineKeyboardMarkup(buttons)) + await message.reply_text(sylmessage.format(message.from_user.first_name)) diff --git a/app/plugins/unban.py b/app/plugins/unban.py index 5dcc292..a46c857 100644 --- a/app/plugins/unban.py +++ b/app/plugins/unban.py @@ -23,14 +23,14 @@ from app import bot, SYL from app import app -from config import DEVS, LOGS +from config import DEVS, LOGS, GBAN_LOGS from app.utils import check_dev from pyrogram.types import Message from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup from pyrogram import filters, Client -@bot.on_message(filters.command("sylunban", ['/', ".", "?"])) +@bot.on_message(filters.command("unscan", ['/', ".", "?"])) async def unban(bot: Client, m: Message): if not m.from_user.id in DEVS: await m.reply_text("Only Captain Can Use Me") @@ -53,17 +53,11 @@ async def unban(bot: Client, m: Message): if m.from_user.id in DEVS and m.reply_to_message: user = m.reply_to_message.from_user.id if not user in DEVS: - user = int(user) - x = SYL.unban(user) - buttons = [[ - InlineKeyboardButton("Support", - url="https://t.me/Sylviorus_support"), - ], - [ - InlineKeyboardButton( - "Report", url="https://t.me/SylviorusReport"), - ]] - + user = int(user) + await bot.send_message(GBAN_LOGS, + f"""/ungban {user}""" + await bot.send_message(GBAN_LOGS, + f"""/unfban {user}""" await bot.send_message(LOGS, f""" #UNBANNED @@ -71,9 +65,6 @@ async def unban(bot: Client, m: Message): **USER** : [{user}](tg://user?id={user}) **ENFORCER** : [{m.from_user.id}](tg://user?id={m.from_user.id}) **CHAT_ID** : {m.chat.id} -""", - reply_markup=InlineKeyboardMarkup(buttons)) - await m.reply(x) - +""") else: await m.reply("Captain Cant Be Unbanned!") diff --git a/app/plugins/ungscan.py b/app/plugins/ungscan.py index 16bc3c6..39659a7 100644 --- a/app/plugins/ungscan.py +++ b/app/plugins/ungscan.py @@ -52,16 +52,12 @@ async def ungscan(bot: Client, m: Message): await m.reply("Unbanning....") for x in users: try: - SYL.unban(x) - buttons = [[ - InlineKeyboardButton("Support", - url="https://t.me/Sylviorus_support"), - ], - [ - InlineKeyboardButton( - "Report", - url="https://t.me/SylviorusReport"), - ]] + await bot.send_message( + LOGS, + f"""/ungban {x}""") + await bot.send_message( + LOGS, + f"""/unfban {x}""") await bot.send_message( LOGS, f""" @@ -70,8 +66,7 @@ async def ungscan(bot: Client, m: Message): **USER** : [{x}](tg://user?id={x}) **ENFORCER** : [{m.from_user.id}](tg://user?id={m.from_user.id}) **CHAT_ID** : {m.chat.id} -""", - reply_markup=InlineKeyboardMarkup(buttons)) +""") time.sleep(1) except Exception as e: await i.edit(f"{e}") diff --git a/app/utils/__init__.py b/app/utils/__init__.py index 86378cb..a2991a0 100644 --- a/app/utils/__init__.py +++ b/app/utils/__init__.py @@ -26,33 +26,6 @@ # from .. import LOGS -class Sylviorus: - - def __init__(self, token) -> None: - self.devs = DEVS - self.logs = LOGS - self.base = "https://sylviorus-api.up.railway.app/" - self.admin_token = token - - def check(self, user: int) -> dict: - data = get(f"{self.base}user/{user}").json() - return data - - def ban(self, user: int, reason: str, enforcer: int) -> str: - data = { - "user": user, - "reason": reason, - "enforcer": enforcer, - "admin_token": self.admin_token - } - res = post(f"{self.base}ban", json=data) - return res.text - - def unban(self, user): - data = {"user": user, "admin_token": self.admin_token} - res = post(f"{self.base}unban", json=data) - return res.text - def check_dev(user: int): if user in DEVS: diff --git a/config.py b/config.py index 036b2d5..2400b7a 100644 --- a/config.py +++ b/config.py @@ -23,11 +23,11 @@ API_ID = "123" API_HASH = "123" -BOT_TOKEN = "123" -SLYTOKEN = "123" +SESSION = "123" MONGO_URI = "mongo db url" REPORT_LOGS = "report log channel" LOGS = "log channel id" +GBAN_LOG = "gban log group id" DEV = [ 825664681, 5086015489 ] diff --git a/session.txt b/session.txt new file mode 100644 index 0000000..809798c --- /dev/null +++ b/session.txt @@ -0,0 +1 @@ +Link https://github.com/MrMissx/string_session/blob/master/main.py