예제 #1
0
                                                     a_user.id)

            current_message = await event.reply(
                current_saved_welcome_message.format(mention=mention,
                                                     title=title,
                                                     count=count,
                                                     first=first,
                                                     last=last,
                                                     fullname=fullname,
                                                     username=username,
                                                     userid=userid),
                file=cws.media_file_id)
            update_previous_welcome(event.chat_id, current_message.id)


@borg.on(admin_cmd(pattern="savewelcome"))  # pylint:disable=E0602
async def _(event):
    if event.fwd_from:
        return
    msg = await event.get_reply_message()
    if msg and msg.media:
        bot_api_file_id = pack_bot_file_id(msg.media)
        add_welcome_setting(event.chat_id, msg.message, True, 0,
                            bot_api_file_id)
        await event.reply("Welcome note saved. ")
    else:
        input_str = event.text.split(None, 1)
        add_welcome_setting(event.chat_id, input_str[1], True, 0, None)
        await event.reply("Welcome note saved. ")

예제 #2
0
from telethon.errors import MessageNotModifiedError
from telethon.errors.rpcerrorlist import StickersetInvalidError
from telethon.tl.functions.messages import GetStickerSetRequest
from telethon.tl.types import (
    DocumentAttributeSticker,
    InputStickerSetID,
    InputStickerSetShortName,
    MessageMediaPhoto,
)
from userbot import ALIVE_NAME

FILLED_UP_DADDY = "Invalid pack selected."
DEFAULTUSER = str(ALIVE_NAME) if ALIVE_NAME else "No name set yet nibba"


@borg.on(admin_cmd(pattern="kang ?(.*)"))
async def _(event):
    if event.fwd_from:
        return
    if not event.is_reply:
        await event.edit(
            "Reply to a photo to add to my personal sticker pack.**( à°  ÍŸÊ– à° )**"
        )
        return
    reply_message = await event.get_reply_message()
    sticker_emoji = "🔥"
    input_str = event.pattern_match.group(1)
    if input_str:
        sticker_emoji = input_str

    user = await bot.get_me()
예제 #3
0
from pikabot.sql_helper.mute_sql import *
from pikabot.utils import admin_cmd
import asyncio

@bot.on(admin_cmd(pattern=r"mute ?(\d+)?"))
async def startmute(event):
    private = False
    if event.fwd_from:
        return
    elif event.is_private:
        await event.reply("Unexpected issues or ugly errors may occur!")
        await asyncio.sleep(3)
        private = True
    if any([x in event.raw_text for x in ("/mute", "!mute")]):
        await asyncio.sleep(0.5)
    else:
        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.reply("Please reply to a user or add their userid into the command to mute them.")
        chat_id = event.chat_id
        chat = await event.get_chat()
        if "admin_rights" in vars(chat) and vars(chat)["admin_rights"] is not None: 
            if chat.admin_rights.delete_messages is True:
                pass
            else:
예제 #4
0
#                 c += 1
#         elif d.is_group:
#             g += 1
#         else:
#             pikalog.info(d.stringify())
#     end = pikatime.now()
#     ms = (end - start).seconds
#     await event.edit("""Obtained in {} seconds.
# Users:\t{}
# Groups:\t{}
# Super Groups:\t{}
# Channels:\t{}
# Bots:\t{}""".format(ms, u, g, c, bc, b))


@borg.on(admin_cmd(pattern="count"))
async def stats(
    event: NewMessage.Event,
) -> None:  # pylint: disable = R0912, R0914, R0915
    """Command to get stats about the account"""
    await event.edit("`Collecting stats, Wait Master`")
    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
예제 #5
0
#                 c += 1
#         elif d.is_group:
#             g += 1
#         else:
#             logger.info(d.stringify())
#     end = datetime.now()
#     ms = (end - start).seconds
#     await event.edit("""Obtained in {} seconds.
# Users:\t{}
# Groups:\t{}
# Super Groups:\t{}
# Channels:\t{}
# Bots:\t{}""".format(ms, u, g, c, bc, b))


@borg.on(admin_cmd(pattern='count'))
async def stats(
        event: NewMessage.Event
) -> None:  # pylint: disable = R0912, R0914, R0915
    """Command to get stats about the account"""
    waiting_message = await event.edit('`Collecting stats, Wait Master`')
    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