예제 #1
0
    name = event.raw_text
    snips = sql.get_chat_blacklist(event.chat_id)
    for snip in snips:
        pattern = r"( |^|[^\w])" + re.escape(snip) + r"( |$|[^\w])"
        if re.search(pattern, name, flags=re.IGNORECASE):
            try:
                await event.delete()
            except Exception:
                await event.reply(
                    "I do not have DELETE permission in this chat")
                sql.rm_from_blacklist(event.chat_id, snip.lower())
            break


@bot.on(admin_cmd(pattern="addblacklist ((.|\n)*)"))
@bot.on(sudo_cmd(pattern="addblacklist ((.|\n)*)", allow_sudo=True))
async def on_add_black_list(event):
    text = event.pattern_match.group(1)
    to_blacklist = list(
        {trigger.strip()
         for trigger in text.split("\n") if trigger.strip()})

    for trigger in to_blacklist:
        sql.add_to_blacklist(event.chat_id, trigger.lower())
    await edit_or_reply(
        event,
        "Added {} triggers to the blacklist in the current chat".format(
            len(to_blacklist)),
    )

예제 #2
0
import time

from telethon.events import NewMessage
from telethon.tl.custom import Dialog
from telethon.tl.types import Channel, Chat, User

from DaisyX import CMD_HELP
from DaisyX.utils import admin_cmd, edit_or_reply, sudo_cmd


@bot.on(admin_cmd(pattern="stats$"))
@bot.on(sudo_cmd(pattern="stats$", allow_sudo=True))
async def stats(
    event: NewMessage.Event,
) -> None:  # pylint: disable = R0912, R0914, R0915
    """Command to get stats about the account"""
    alain = await edit_or_reply(event, "`Cᴏʟʟᴇᴄᴛɪɴɢ sᴛᴀᴛs...`")
    start_time = time.time()
    private_chats = 0
    bots = 0
    groups = 0
    broadcast_channels = 0
    admin_in_groups = 0
    creator_in_groups = 0
    admin_in_broadcast_channels = 0
    creator_in_channels = 0
    unread_mentions = 0
    unread = 0
    dialog: Dialog
    async for dialog in event.client.iter_dialogs():
        entity = dialog.entity
예제 #3
0
    return user_obj, extra


async def get_user_sender_id(user, event):
    if isinstance(user, str):
        user = int(user)
    try:
        user_obj = await event.client.get_entity(user)
    except (TypeError, ValueError) as err:
        await event.edit(str(err))
        return None
    return user_obj


@borg.on(admin_cmd(pattern="gban ?(.*)"))
@borg.on(sudo_cmd("gban ?(.*)", allow_sudo=True))
async def gspider(ULTRA):
    lol = ULTRA
    sender = await lol.get_sender()
    me = await lol.client.get_me()
    if not sender.id == me.id:
        friday = await lol.reply("GBanning This Retard DumbAss😁😁")
    else:
        friday = await lol.edit("Wait Processing.....")
    me = await ULTRA.client.get_me()
    await friday.edit(f"Global Ban Is Coming ! Wait And Watch You bitch😎🔥")
    my_mention = "[{}](tg://user?id={})".format(me.first_name, me.id)
    f"@{me.username}" if me.username else my_mention
    await ULTRA.get_chat()
    a = b = 0
    if ULTRA.is_private:
예제 #4
0
import os
from datetime import datetime
from pathlib import Path

from DaisyX import ALIVE_NAME, CMD_HELP, bot
from DaisyX.utils import admin_cmd
from DaisyX.utils import edit_or_reply as eor
from DaisyX.utils import load_module, remove_plugin, sudo_cmd

DELETE_TIMEOUT = 3
thumb_image_path = "./Resources/daisy.jpg"
DEFAULTUSER = str(ALIVE_NAME) if ALIVE_NAME else "ᴅᴀɪsʏ x"


@bot.on(admin_cmd(pattern=r"send (?P<shortname>\w+)", outgoing=True))
@bot.on(sudo_cmd(pattern=r"send (?P<shortname>\w+)", allow_sudo=True))
async def send(event):
    if event.fwd_from:
        return
    bot.uid
    message_id = event.message.id
    thumb = thumb_image_path
    input_str = event.pattern_match.group(1)
    the_plugin_file = "./DaisyX/modules/{}.py".format(input_str)
    if os.path.exists(the_plugin_file):
        start = datetime.now()
        pro = await event.client.send_file(
            event.chat_id,
            the_plugin_file,
            force_document=True,
            allow_cache=False,
예제 #5
0
import os
from datetime import datetime

from PIL import Image
from telegraph import Telegraph, exceptions, upload_file

from DaisyX import CMD_HELP
from DaisyX.utils import admin_cmd, sudo_cmd

telegraph = Telegraph()
r = telegraph.create_account(short_name=Config.TELEGRAPH_SHORT_NAME)
auth_url = r["auth_url"]


@borg.on(admin_cmd("t(m|t) ?(.*)"))
@borg.on(sudo_cmd("t(m|t) ?(.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    if Config.PRIVATE_GROUP_BOT_API_ID is None:
        await event.edit(
            "Please set the required environment variable `PRIVATE_GROUP_BOT_API_ID` for this plugin to work"
        )
        return
    if not os.path.isdir(Config.TMP_DOWNLOAD_DIRECTORY):
        os.makedirs(Config.TMP_DOWNLOAD_DIRECTORY)
    await borg.send_message(
        Config.PRIVATE_GROUP_BOT_API_ID,
        "Created New Telegraph account {} for the current session. \n**Do not give this url to anyone, even if they say they are from Telegram!**"
        .format(auth_url),
    )
예제 #6
0
            [
                Button.url(
                    f"⚜️ Rᴇᴘᴏ ⚜️", url="https://github.com/TeamDaisyX/Daisy-X-UB"
                ),
                Button.url(
                    f"🌚 Sᴜᴘᴘᴏʀᴛ Cʜᴀᴛ 🌝", url="https://t.me/DaisySupport_Official"
                ),
            ],
            [
                Button.url(
                    f"🔰 Dᴇᴘʟᴏʏ 🔰",
                    url="https://dashboard.heroku.com/new?button-url=https%3A%2F%2Fgithub.com%2FTeamDaisyX%2FDaisy-X-UB&template=https%3A%2F%2Fgithub.com%2FTeamDaisyX%2FDaisy-X-UB",
                ),
                Button.url(
                    f"💠 Sᴛʀɪɴɢ 💠", url="https://repl.it/@SpEcHiDe/GenerateStringSession"
                ),
            ],
        ],
    )


# (c) Copyright 2021-2022 TeamDaisyX
# Made by Devil (@Lucifeermorningstar) and @RoseHaterX


@bot.on(admin_cmd(pattern="repo"))
@bot.on(sudo_cmd(pattern="repo ? (.*) ", allow_sudo=True))
async def repo(event):
    buttons = [Button.url(f"⚜️ Rᴇᴘᴏ ⚜️", "https://github.com/TeamDaisyX/Daisy-X-UB")]
    await event.edit("**DAISYX UB**", buttons=buttons)
예제 #7
0
# Made By CatUserBot
import os
import shutil

from DaisyX import CMD_HELP
from DaisyX.google_image import googleimagesdownload
from DaisyX.utils import admin_cmd, sudo_cmd


@bot.on(admin_cmd(pattern=r"img(?: |$)(\d*)? ?(.*)"))
@bot.on(sudo_cmd(pattern=r"img(?: |$)(\d*)? ?(.*)", allow_sudo=True))
async def img_sampler(event):
    if event.fwd_from:
        return
    if event.reply_to_msg_id:
        reply_to_id = event.reply_to_msg_id
    else:
        reply_to_id = event.id
    if event.is_reply and not event.pattern_match.group(2):
        query = await event.get_reply_message()
        query = str(query.message)
    else:
        query = str(event.pattern_match.group(2))
    if not query:
        return await edit_or_reply(
            event, "Reply to a message or pass a query to search!"
        )
    cat = await edit_or_reply(event, "`Processing...`")
    if event.pattern_match.group(1) != "":
        lim = int(event.pattern_match.group(1))
        if lim > 10:
예제 #8
0
            return None
        except (TypeError, ValueError):
            await event.reply("`Invalid channel/group`")
            return None
    return chat_info


def user_full_name(user):
    names = [user.first_name, user.last_name]
    names = [i for i in list(names) if i]
    full_name = " ".join(names)
    return full_name


@bot.on(admin_cmd(pattern="inviteall ?(.*)"))
@bot.on(sudo_cmd(pattern="inviteall ?(.*)", allow_sudo=True))
async def get_users(event):
    sender = await event.get_sender()
    me = await event.client.get_me()
    if not sender.id == me.id:
        hell = await event.reply("`processing...`")
    else:
        hell = await event.edit("`processing...`")
    legendx22 = await get_chatinfo(event)
    chat = await event.get_chat()
    if event.is_private:
        return await hell.edit("`Sorry, Can add users here`")
    s = 0
    f = 0
    error = "None"
예제 #9
0
# Licensed under the Raphielscape Public License, Version 1.c (the "License");
# you may not use this file except in compliance with the License.
#
""" Userbot module for purging unneeded messages(usually spam or ot). """

from asyncio import sleep

from telethon.errors import rpcbaseerrors

from DaisyX import BOTLOG, BOTLOG_CHATID, CMD_HELP
from DaisyX.utils import admin_cmd, errors_handler, sudo_cmd


# @register(outgoing=True, pattern="^.purge$")
@borg.on(admin_cmd(pattern=r"purge"))
@borg.on(sudo_cmd(pattern=r"purge", allow_sudo=True))
@errors_handler
async def fastpurger(purg):
    """For .purge command, purge all messages starting from the reply."""
    chat = await purg.get_input_chat()
    msgs = []
    count = 0

    async for msg in purg.client.iter_messages(chat,
                                               min_id=purg.reply_to_msg_id):
        msgs.append(msg)
        count = count + 1
        msgs.append(purg.reply_to_msg_id)
        if len(msgs) == 100:
            await purg.client.delete_messages(chat, msgs)
            msgs = []
예제 #10
0
# (c) Copyright 2021-2022 DaisyX

import asyncio
import os
import sys

from DaisyX.utils import admin_cmd, sudo_cmd


@bot.on(admin_cmd(pattern="restart"))
@bot.on(sudo_cmd(pattern="restart ?(.*)", allow_sudo=True))
async def _(event):
    k = await bot.send_message(event.chat_id, "`Wait restarting`")
    asyncio.sleep(0.5)
    await k.edit("`Restarted successfully`")
    await event.delete()
    os.execl(sys.executable, sys.executable, *sys.argv)
    quit()


# Made by Devil ( @lucifeermorningstar)


@bot.on(admin_cmd(pattern="update"))
@bot.on(sudo_cmd(pattern="update ? (.*)", allow_sudo=True))
async def update(event):
    await event.edit(
        "•• **ᴅᴏ ʏᴏᴜ ᴡᴀɴɴᴀ ᴜᴘᴅᴀᴛᴇ ʏᴏᴜʀ ᴅᴀɪsʏx ᴜsᴇʀʙᴏᴛ ᴛʜᴇɴ ᴊᴜsᴛ `.restart` ᴏɴʟʏ **••"
    )
예제 #11
0
from pygments.lexers import Python3Lexer

from DaisyX import CMD_HELP
from DaisyX.utils import admin_cmd, sudo_cmd


def progress(current, total):
    logger.info("Downloaded {} of {}\nCompleted {}".format(
        current, total, (current / total) * 100))


from DaisyX.utils import admin_cmd, sudo_cmd


@bot.on(admin_cmd(pattern="neko(?: |$)(.*)", outgoing=True))
@bot.on(sudo_cmd(pattern="neko(?: |$)(.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    catevent = await edit_or_reply(event, "`Pasting to neko bin.....`")
    input_str = "".join(event.text.split(maxsplit=1)[1:])
    if input_str:
        message = input_str
        downloaded_file_name = None
    elif event.reply_to_msg_id:
        previous_message = await event.get_reply_message()
        if previous_message.media:
            downloaded_file_name = await event.client.download_media(
                previous_message,
                Config.TEMP_DIR,
            )
예제 #12
0
        await asyncio.sleep(10)
        await no_admin_privilege_message.edit(
            "This is useless SPAM dude. Stop this, enjoy chat man ",
            link_preview=False)
    else:
        await event.client.send_message(
            entity=event.chat_id,
            message="""**Automatic AntiFlooder**
[User](tg://user?id={}) has been automatically restricted
because he reached the defined flood limit.""".format(event.message.sender_id),
            reply_to=event.message.id,
        )


@bot.on(admin_cmd(pattern="setflood(?: |$)(.*)"))
@bot.on(sudo_cmd(pattern="setflood(?: |$)(.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    input_str = event.pattern_match.group(1)
    event = await edit_or_reply(event, "updating flood settings!")
    try:
        sql.set_flood(event.chat_id, input_str)
        sql.__load_flood_settings()
        await event.edit(
            "Antiflood updated to {} in the current chat".format(input_str))
    except Exception as e:  # pylint:disable=C0103,W0703
        await event.edit(str(e))


CMD_HELP.update({
예제 #13
0
# (c) Copyright 2021-2022 DaisyX
# Made By LegendX22 and Proboy22

import asyncio

from DaisyX import CMD_HELP, bot
from DaisyX.legend import NAME
from DaisyX.utils import admin_cmd, sudo_cmd

PRO = NAME


@bot.on(admin_cmd("superfban ?(.*)"))
@bot.on(sudo_cmd("superfban ?(.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    await event.edit(f"**𝙳𝙰𝙸𝚂𝚈X Sᴜᴘᴇʀғᴀʙɴ Cᴏᴍɪɴɢ Oɴ Oʀᴅᴇʀ Oғ {PRO}**...")
    fedList = []
    if event.reply_to_msg_id:
        previous_message = await event.get_reply_message()
        if previous_message.media:
            downloaded_file_name = await bot.download_media(
                previous_message, "fedlist")
            await asyncio.sleep(6)
            file = open(downloaded_file_name, "r")
            lines = file.readlines()
            for line in lines:
                try:
                    fedList.append(line[:36])
                except BaseException:
예제 #14
0
import asyncio
import math
import os
import time
from datetime import datetime

from pySmartDL import SmartDL

from DaisyX.utils import admin_cmd, sudo_cmd, humanbytes, progress
from DaisyX import ALIVE_NAME, CMD_HELP

DEFAULTUSER = str(ALIVE_NAME) if ALIVE_NAME else "𝙳𝙰𝙸𝚂𝚈 𝚇"


@bot.on(admin_cmd(pattern="download(?: |$)(.*)", outgoing=True))
@bot.on(sudo_cmd(pattern="download(?: |$)(.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    mone = await edit_or_reply(event, "`Processing ...`")
    input_str = event.pattern_match.group(1)
    if not os.path.isdir(Config.TMP_DOWNLOAD_DIRECTORY):
        os.makedirs(Config.TMP_DOWNLOAD_DIRECTORY)
    if event.reply_to_msg_id:
        start = datetime.now()
        reply_message = await event.get_reply_message()
        try:
            c_time = time.time()
            downloaded_file_name = await event.client.download_media(
                reply_message,
                Config.TMP_DOWNLOAD_DIRECTORY,
예제 #15
0
    return user_obj, extra


async def get_user_sender_id(user, event):
    if isinstance(user, str):
        user = int(user)
    try:
        user_obj = await event.client.get_entity(user)
    except (TypeError, ValueError) as err:
        await event.edit(str(err))
        return None
    return user_obj


@borg.on(admin_cmd(pattern="gban ?(.*)"))
@borg.on(sudo_cmd("gban ?(.*)", allow_sudo=True))
async def gspider(ULTRA):
    lol = ULTRA
    sender = await lol.get_sender()
    me = await lol.client.get_me()
    if not sender.id == me.id:
        friday = await lol.reply("GBanning This Retard DumbAss😁😁")
    else:
        friday = await lol.edit("Wait Processing.....")
    me = await ULTRA.client.get_me()
    await friday.edit(f"Global Ban Is Coming ! Wait And Watch You bitch😎🔥")
    my_mention = "[{}](tg://user?id={})".format(me.first_name, me.id)
    f"@{me.username}" if me.username else my_mention
    await ULTRA.get_chat()
    a = b = 0
    if ULTRA.is_private:
예제 #16
0
import asyncio

from DaisyX import CMD_HELP
from DaisyX.modules.sql_helper.mute_sql import is_muted, mute, unmute
from DaisyX.utils import admin_cmd, sudo_cmd


# @command(outgoing=True, pattern=r"^.gmute ?(\d+)?")
@borg.on(admin_cmd(pattern=r"gmute ?(\d+)?"))
@borg.on(sudo_cmd("gmute ?(.*)", allow_sudo=True))
async def startgmute(event):
    private = False
    if event.fwd_from:
        return
    elif event.is_private:
        await event.edit("gмυтιηg тнιѕ ρєяѕση...")
        await asyncio.sleep(3)
        private = True
    reply = await event.get_reply_message()
    if event.pattern_match.group(1) is not None:
        userid = event.pattern_match.group(1)
    elif reply is not None:
        userid = reply.sender_id
    elif private is True:
        userid = event.chat_id
    else:
        return await event.edit(
            "Please reply to a user or add their into the command to gmute them."
        )
    event.chat_id
    await event.get_chat()
예제 #17
0
DEFAULTUSER = str(ALIVE_NAME) if ALIVE_NAME else bot.me.first_name

global ghanti
ghanti = borg.uid
edit_time = 5
""" =======================CONSTANTS====================== """
file1 = "https://telegra.ph/file/b174bd3efbe9590a8e2e4.jpg"
file2 = "https://telegra.ph/file/70bf9fd1f0571ebf29be3.jpg"
file3 = "https://telegra.ph/file/62928bf1b39acce656417.jpg"
file4 = "https://telegra.ph/file/22ab2fe44d05ed825c422.jpg"
""" =======================CONSTANTS====================== """


@borg.on(admin_cmd(pattern=r"awake"))
@borg.on(sudo_cmd(pattern=r"awake", allow_sudo=True))
async def hmm(yes):
    await yes.get_chat()
    global ghanti
    ghanti = borg.uid
    await yes.delete()
    uptime = await dcdef.get_readable_time((time.time() - Lastupdate))
    pm_caption = "** 𝙳𝙰𝙸𝚂𝚈 𝚇 𝙸𝚂 𝙾𝙽𝙻𝙸𝙽𝙴**\n\n"
    pm_caption += "**Yes Master, Am Alive And Systems Are Working Perfectly As It Should Be...**\n\n"
    pm_caption += "✘ About My System ✘\n\n"
    pm_caption += f"➾ **ᴛᴇʟᴇᴛʜᴏɴ ᴠᴇʀꜱɪᴏɴ** ☞ {version.__version__}\n"
    pm_caption += "➾ **ꜱᴜᴘᴘᴏʀᴛ ᴄʜᴀɴɴᴇʟ** ☞ [ᴊᴏɪɴ](https://t.me/DaisySupport_Official)\n"
    pm_caption += "➾ **ʟɪᴄᴇɴꜱᴇ**  ☞ [𝚃𝙴𝙰𝙼 𝙳𝙰𝙸𝚂𝚈𝚇](https://github.com/TeamDaisyX)\n"
    pm_caption += (
        "➾ **ᴄᴏᴘʏʀɪɢʜᴛ ʙʏ** ☞ [𝙳𝙰𝙸𝚂𝚈-𝚇](https://github.com/TeamDaisyX/Daisy-X-UB)\n\n"
    )
예제 #18
0
import json
import re
import urllib.parse
from os import popen
from random import choice

import requests
from bs4 import BeautifulSoup
from humanize import naturalsize

from DaisyX.utils import admin_cmd, edit_or_reply, sudo_cmd
from DaisyX import CMD_HELP


@bot.on(admin_cmd(outgoing=True, pattern=r"direct(?: |$)([\s\S]*)"))
@bot.on(sudo_cmd(allow_sudo=True, pattern=r"direct(?: |$)([\s\S]*)"))
async def direct_link_generator(request):
    """ direct links generator """
    hellevent = await edit_or_reply(request, "`Processing...`")
    textx = await request.get_reply_message()
    message = request.pattern_match.group(1)
    if message:
        pass
    elif textx:
        message = textx.text
    else:
        await hellevent.edit("`Usage: .direct <url>`")
        return
    reply = ""
    links = re.findall(r"\bhttps?://.*\.\S+", message)
    if not links:
예제 #19
0
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
"""Urban Dictionary
Syntax: .ud Query"""
import asyncurban
from PyDictionary import PyDictionary

from DaisyX import CMD_HELP
from DaisyX.utils import admin_cmd, edit_or_reply, sudo_cmd


@bot.on(admin_cmd(pattern="ud (.*)"))
@bot.on(sudo_cmd(pattern="ud (.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    word = event.pattern_match.group(1)
    urban = asyncurban.UrbanDictionary()
    try:
        mean = await urban.get_word(word)
        await edit_or_reply(
            event,
            "Text: **{}**\n\nMeaning: **{}**\n\nExample: __{}__".format(
                mean.word, mean.definition, mean.example
            ),
        )
    except asyncurban.WordNotFoundError:
        await edit_or_reply(event, "No result found for **" + word + "**")

예제 #20
0
import pyfiglet

from DaisyX.utils import admin_cmd, sudo_cmd


# @command(pattern="^.figlet ?(.*)", outgoing=True)
@borg.on(admin_cmd(pattern=r"figlet ?(.*)"))
@bot.on(sudo_cmd(pattern="figlet$", allow_sudo=True))
async def figlet(event):
    if event.fwd_from:
        return
    CMD_FIG = {
        "slant": "slant",
        "3D": "3-d",
        "5line": "5lineoblique",
        "alpha": "alphabet",
        "banner": "banner3-D",
        "doh": "doh",
        "iso": "isometric1",
        "letter": "letters",
        "allig": "alligator",
        "dotm": "dotmatrix",
        "bubble": "bubble",
        "bulb": "bulbhead",
        "digi": "digital",
    }
    input_str = event.pattern_match.group(1)
    if "|" in input_str:
        text, cmd = input_str.split("|", maxsplit=1)
    elif input_str is not None:
        cmd = None