Пример #1
0
def mention_everyone(bot: BOT, message: Message):
    mentions = "".join("[\u200E](tg://user?id={})".format(x.user.id)
                       for x in BOT.iter_chat_members(message.chat.id))
    BOT.send_message(message.chat.id,
                     message.text.replace('.m', '') + mentions,
                     reply_to_message_id=ReplyCheck(message))
    message.delete()
Пример #2
0
def post_gentoo(bot: BOT, message: Message):
    if re.match("(?i)(post|install|get|send) (gentoo|linux)", message.text):
        if random.randint(1, 4) == 1:
            image = random.choice(d['gentoo_file_ids']['gif'])
            BOT.send_animation(
                chat_id=message.chat.id,
                animation=image,
                disable_notification=True,
                reply_to_message_id=ReplyCheck(message),
            )
        else:
            image = random.choice(d['gentoo_file_ids']['photo'])
            BOT.send_photo(
                chat_id=message.chat.id,
                photo=image,
                disable_notification=True,
                reply_to_message_id=ReplyCheck(message),
            )
Пример #3
0
def gender(bot: BOT, message: Message):
    if message.reply_to_message is not None:
        first_name = message.reply_to_message.from_user.first_name
        message.reply(genderize(first_name))
        BOT.send_message(
            chat_id=message.chat.id,
            text=genderize(first_name),
            disable_notification=True,
            reply_to_message_id=ReplyCheck(message),
        )
    else:
        first_name = message.text.replace("!gender", "")
        BOT.send_message(
            chat_id=message.chat.id,
            text=genderize(first_name),
            disable_notification=True,
            reply_to_message_id=ReplyCheck(message),
        )
Пример #4
0
def post_omdb(bot: BOT, message: Message):
    message_text = message.text.replace("!omdb ", "")
    text = get_omdb(message_text)
    BOT.send_message(
        chat_id=message.chat_id,
        text=text,
        disable_notification=True,
        reply_to_message_id=ReplyCheck(message),
    )
    if message.from_user.is_self:
        message.delete()
Пример #5
0
def post_rose(bot: BOT, message: Message):
    if re.match(
            "(?i)(post|get|send) (rose|indigo girl|blue girl|love|roze|crush|🌹)",
            message.text):
        image = random.choice(d['rose_file_ids']['photo'])
        BOT.send_photo(chat_id=message.chat.id,
                       photo=image,
                       disable_notification=True,
                       reply_to_message_id=ReplyCheck(message))
        if message.from_user.is_self:
            message.delete()
Пример #6
0
def post_merchant(bot: BOT, message: Message):
    if re.match("(?i)(post|get|send) (merchant|jew|rabbi)", message.text):
        if random.randint(1, 4) == 1:
            image = random.choice(d['merchant_file_ids']['gif'])
            BOT.send_animation(
                chat_id=message.chat.id,
                animation=image,
                disable_notification=True,
                reply_to_message_id=ReplyCheck(message),
            )
        else:
            image = random.choice(d['merchant_file_ids']['photo'])
            BOT.send_photo(
                chat_id=message.chat.id,
                photo=image,
                disable_notification=True,
                reply_to_message_id=ReplyCheck(message),
            )
        if message.from_user.is_self:
            message.delete()
Пример #7
0
def post_kot(bot: BOT, message: Message):
    if re.match("(?i)(post|get|send) (kot|kots|cat|cats|🐱|🐈|😸|🐱)",
                message.text):
        kot_link = get_kot(mime_types="jpg,png")
        BOT.send_photo(
            chat_id=message.chat.id,
            photo=kot_link,
            reply_to_message_id=ReplyCheck(message),
            disable_notification=True,
        )
        if message.from_user.is_self:
            message.delete()
Пример #8
0
def post_kot_gif(bot: BOT, message: Message):
    if re.match("(?i)(post|get|send) (kot|kots|cat|cats|🐱|🐈|😸|🐱) (gif|gifs)",
                message.text):
        kot_gif = get_kot(mime_types="gif")
        BOT.send_animation(
            chat_id=message.chat.id,
            animation=kot_gif,
            reply_to_message_id=ReplyCheck(message),
            disable_notification=True,
        )
        if message.from_user.is_self:
            message.delete()
Пример #9
0
def wiki(bot: BOT, message: Message):
    topic = message.text.replace("!wiki ", "")
    summary = wikipedia_summary(topic)

    BOT.send_message(
        chat_id=message.chat.id,
        text=summary,
        disable_notification=True,
        reply_to_message_id=ReplyCheck(message),
    )

    if message.from_user.is_self:
        message.delete()
Пример #10
0
def pwiki(bot: BOT, message: Message):
    drug = message.text.replace("!pwiki ", "")
    text = get_drug(drug)
    BOT.send_message(
        chat_id=message.chat.id,
        text=text[0],
        disable_notification=True,
        reply_to_message_id=ReplyCheck(message),
    )
    BOT.send_message(chat_id=message.chat.id,
                     text=text[1],
                     disable_notification=True)
    if message.from_user.is_self:
        message.delete()
Пример #11
0
def post_oadb(bot: BOT, message: Message):
    message_text = message.text.replace("!oadb ", "")
    data = oadb(message_text)
    BOT.send_message(
        chat_id=message.chat_id,
        text=data[0],
        disable_notification=True,
        reply_to_message_id=ReplyCheck(message),
    )

    BOT.send_photo(chat_id=message.chat.id,
                   photo=data[1],
                   disable_notification=True)
    if message.from_user.is_self:
        message.delete()
Пример #12
0
def post_ud(bot: BOT, message: Message):
    message_text = message.text.replace("!ud ", "")
    text = define_word_ud(message_text)
    BOT.send_message(
        chat_id=message.chat.id,
        text=text[:4096],
        disable_notification=True,
        reply_to_message_id=ReplyCheck(message),
    )
    if text[4096:]:
        BOT.send_message(chat_id=message.chat.id,
                         text=text[4096:],
                         disable_notification=True)
    if message.from_user.is_self:
        message.delete()