示例#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 send_dog(bot: BOT, message: Message):
    if re.match("(?i)(post|get|send) (dog|doggo|woof|🐶|🐕) (gif|gifs)", message.text):
        link_to_image = get_dog("webm,png,jpg,jpeg")
        BOT.send_animation(
            chat_id=message.chat.id, animation=link_to_image, disable_notification=True
        )
        if message.from_user.is_self:
            message.delete()
示例#3
0
def post_redpill(bot: BOT, message: Message):
    if re.match("(?i)(post|get|send) (redpill|meme|maymay)", message.text):
        image = random.choice(d['redpill_file_ids']['photo'])
        BOT.send_photo(chat_id=message.chat.id,
                       photo=image,
                       disable_notification=True)
        if message.from_user.is_self:
            message.delete()
示例#4
0
def post_swift(bot: BOT, message: Message):
    if re.match("(?i)(post|get|send) (tay|taytay|taylor|tswift|swift|trap)",
                message.text):
        image = random.choice(d['swift_file_ids']['photo'])
        BOT.send_photo(chat_id=message.chat.id,
                       photo=image,
                       disable_notification=True)
        if message.from_user.is_self:
            message.delete()
示例#5
0
def post_911(bot: BOT, message: Message):
    if re.match(
            "(?i)((post|get|send) (911|bush|twin towers|wtc)|bush did (911|9/11))",
            message.text):
        image = random.choice(d['911_file_ids']['photo'])
        BOT.send_photo(chat_id=message.chat.id,
                       photo=image,
                       disable_notification=True)
        if message.from_user.is_self:
            message.delete()
示例#6
0
def post_sminem(bot: BOT, message: Message):
    if re.match(
            "(?i)(post|get|send) (sminem|smnem|smn|big ear (kid|guy)|chromosome)",
            message.text):
        image = random.choice(d['sminem_file_ids']['photo'])
        BOT.send_photo(chat_id=message.chat.id,
                       photo=image,
                       disable_notification=True)
        if message.from_user.is_self:
            message.delete()
示例#7
0
def post_watson(bot: BOT, message: Message):
    if re.match(
            "(?i)(post|get|send) (w***e|s**t|watson|emma|hermione|granger|harry potter girl)",
            message.text):
        image = random.choice(d['emma_file_ids']['photo'])
        BOT.send_photo(chat_id=message.chat.id,
                       photo=image,
                       disable_notification=True)
        if message.from_user.is_self:
            message.delete()
示例#8
0
def fix_ngr_spk(bot: BOT, message: Message):
    if "tbh" in message.text:
        message_text = message.text.replace("tbh", "to be honest")
    elif "idk" in message.text:
        message_text = message.text.replace("idk", "I don't know")
    elif "wdym" in message.text:
        message_text = message.text.replace("wdym", "what do you mean")

    BOT.edit_message_text(
        chat_id=message.chat.id, message_id=message.message_id, text=message_text
    )
示例#9
0
def post_trump(bot: BOT, message: Message):
    if re.match("(?i)(post|get|send) (drumpf|trump|orange man)", message.text):
        image = random.choice(d['drump_file_ids']['photo'])
        BOT.send_photo(
            chat_id=message.chat.id,
            photo=image,
            disable_notification=True,
            caption=drumpf_quote(),
        )
        if message.from_user.is_self:
            message.delete()
示例#10
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()
示例#11
0
def send_dog_gif(bot: BOT, message: Message):
    if re.match("(?i)(post|get|send) (dog|doggo|woof|🐶|🐕)", message.text):
        if randint(0, 1) == 1:
            link_to_image = get_dog("webm,mp4")
        else:
            link_to_image = get_doggo()
        BOT.send_photo(
            chat_id=message.chat.id, photo=link_to_image, disable_notification=True
        )
        if message.from_user.is_self:
            message.delete()
示例#12
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()
示例#13
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()
示例#14
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()
示例#15
0
文件: wiki.py 项目: Tran-Phi/Blocbot
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()
示例#16
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()
示例#17
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()
示例#18
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()
示例#19
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),
            )
示例#20
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),
        )
示例#21
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()
示例#22
0
def translate_message(bot: BOT, message: Message):
    if message.reply_to_message is not None:
        tolang = message.text[-2:]
        if "et" in tolang:
            tolang = "et"
        elif "en" in tolang:
            tolang = "en"
        elif "ru" in tolang:
            tolang = "ru"
        elif "lv" in tolang:
            tolang = "lv"
        else:
            tolang = ""
        replied_message = message.reply_to_message.text
        translated_text = translate_neurotolge(replied_message, to_lang=tolang)
        BOT.send_message(
            chat_id=message.chat.id,
            text=translated_text,
            disable_notification=True,
            reply_to_message_id=message.reply_to_message.message_id,
        )
示例#23
0
def greet_new_users(bot: BOT, message: Message):
    new = message.new_chat_members
    for user in new:
        if arabian.search(user.first_name):
            BOT.kick_chat_member(chat_id=message.chat.id,
                                 user_id=message.reply_to_message.from_user.id,
                                 until_date=0)
            BOT.send_message(
                message.chat.id,
                "arabian characters detected in name, user kicked from the chat"
            )
        else:
            BOT.send_photo(nfc,
                           "AgADBAAD0bExG9D-CVDg8aFwJMFwJ3gC",
                           reply_to_message_id=message.message_id)
示例#24
0
def post_brexit(bot: BOT, message: Message):
    image = random.choice(d['farage_file_ids']['photo'])
    BOT.send_photo(chat_id=message.chat.id,
                   photo=image,
                   disable_notification=True)