Example #1
0
    await SAVED_SETTINGS.update_one({"_id": "BOT_PM"},
                                    {"$set": {
                                        "data": BOT_PM
                                    }},
                                    upsert=True)
    await msg.edit(
        f"Bot Pm `{'Disabled ❌' if not BOT_PM else 'Enabled ✅'}` Successully.",
        del_in=5)


if userge.has_bot:
    userge_id = userge.id if userge.dual_mode else config.OWNER_ID[0]
    bot = userge.bot

    @bot.on_message(~bannedFilter & ~filters.edited
                    & filters.private & filters.command("start"),
                    group=1)
    async def start(_, msg: PyroMessage):
        user_id = msg.from_user.id
        user_dict = await bot.get_user_dict(user_id)
        text = START_TEXT.format_map(SafeDict(**user_dict))
        path = None
        if botpm.START_MEDIA:
            pattern = r"^https://telegra\.ph/file/\w+\.\w+$"
            if not re.match(pattern, botpm.START_MEDIA):
                await CHANNEL.log("Your `START_MEDIA` var is Invalid.")
            else:
                path = os.path.join(config.Dynamic.DOWN_PATH,
                                    os.path.split(botpm.START_MEDIA)[1])
                if not os.path.exists(path):
                    await pool.run_in_thread(wget.download)(botpm.START_MEDIA,
Example #2
0
                            InlineQueryResultArticle, InputTextMessageContent,
                            InlineKeyboardMarkup)
from pyrogram.types import Message as PyroMessage
from userge import userge, filters, config

PRVT_MSGS = {}
FILTER = filters.create(lambda _, __, q: '-' in q.query and q.from_user and q.
                        from_user.id in config.OWNER_ID)
MEDIA_FID_S = {}
DEEP_LINK_FLITER = filters.private & filters.create(
    lambda _, __, msg: msg.text and msg.text.startswith("/start prvtmsg"))


@userge.bot.on_message(
    filters.user(list(config.OWNER_ID)) & ~filters.edited
    & filters.command("secretmsg", config.SUDO_TRIGGER))
async def recv_s_m_o(_, msg: PyroMessage):
    replied = msg.reply_to_message
    if not replied:
        return await msg.reply_text("reply to a message")
    media_type = replied.media
    if media_type and media_type in [
            "contact",
            "dice",
            "poll",
            "location",
            "venue",
    ]:
        await msg.reply_text("invalid media type")
        return
    media_ifdd = getattr(replied, media_type)
Example #3
0
async def leavevc(msg: Message):
    """ leave voice chat """
    global CHAT_NAME, CHAT_ID  # pylint: disbale=global-statement

    await msg.delete()

    if CHAT_NAME is not None:
        await call.stop()
        await asyncio.sleep(2)
        CHAT_NAME = None
        CHAT_ID = 0
    else:
        await reply_text(msg, "`I didn't find any Voice-Chat to leave")


@userge.on_filters(filters.group & filters.command("play"))
async def play_music(msg: Message):
    """ play music in voice chat """

    if not CHAT_ID or msg.chat.id != CHAT_ID:
        return

    if msg.input_str:
        if re.match(yt_regex, msg.input_str):
            QUEUE.append(msg)
            await reply_text(
                msg, f"[Song]({msg.input_str}) "
                f"Scheduled to QUEUE on #{len(QUEUE)} position.")
        else:
            await reply_text(msg, "Only youtube links are supported")
    elif (msg.reply_to_message and msg.reply_to_message.audio):
Example #4
0
    await SAVED_SETTINGS.update_one({"_id": "BOT_PM"},
                                    {"$set": {
                                        "data": BOT_PM
                                    }},
                                    upsert=True)
    await msg.edit(
        f"Bot Pm `{'Disabled ❌' if not BOT_PM else 'Enabled ✅'}` Successully.",
        del_in=5)


if userge.has_bot:
    userge_id = userge.id if userge.dual_mode else Config.OWNER_ID[0]
    bot = userge.bot

    @bot.on_message(~bannedFilter & ~filters.edited & filters.private
                    & filters.command("start"))
    async def start(_, msg: PyroMessage):
        global _HAVE_BLOCKED, _USERS  # pylint: disable=global-statement
        START_MEDIA = os.environ.get("START_MEDIA", None)
        user_id = msg.from_user.id
        user_dict = await bot.get_user_dict(user_id)
        text = START_TEXT.format_map(SafeDict(**user_dict))
        path = None
        if START_MEDIA:
            pattern = r"^https://telegra\.ph/file/\w+\.\w+$"
            if not re.match(pattern, START_MEDIA):
                await CHANNEL.log("Your `START_MEDIA` var is Invalid.",
                                  "ERROR")
            else:
                path = os.path.join(Config.DOWN_PATH,
                                    os.path.split(Config.START_MEDIA)[1])