示例#1
0
 def __sticker(message):
     bot.send_sticker(
         chat_id=CONFESSION,
         data=message.sticker.file_id,
     )
     reply = "<b>Photo has been sent to the confession! Check the channel</b>"
     bot.reply_to(message, reply, parse_mode='HTML')
     pass
示例#2
0
 def __video(message):
     bot.reply_to(message, "<b>Video Received</b>", parse_mode='HTML')
     content = f"<b>{random.choice(PERSON)} {random.choice(CONTENT)}.</b>"
     bot.send_video(chat_id=CONFESSION,
                    data=message.video.file_id,
                    caption=content,
                    parse_mode="HTML")
     reply = "<b>Video has been sent to the confession! Check the channel</b>"
     bot.reply_to(message, reply, parse_mode='HTML')
示例#3
0
 def __audio(message):
     bot.reply_to(message, "<b>Audio Received</b>", parse_mode='HTML')
     bot.send_chat_action(message.chat.id, 'upload_audio')
     content = f"<b>{random.choice(PERSON)} {random.choice(CONTENT)}.</b>"
     bot.send_audio(chat_id=CONFESSION,
                    audio=message.audio.file_id,
                    title=message.audio.title,
                    performer=message.audio.performer,
                    caption=content,
                    parse_mode='HTML')
     reply = "<b>Audio has been sent to the confession! Check the channel</b>"
     bot.reply_to(message, reply, parse_mode='HTML')
示例#4
0
 def __document(message):
     bot.reply_to(message, "<b>Document Received</b>", parse_mode='HTML')
     content = f"<b>{random.choice(PERSON)} {random.choice(CONTENT)}.</b>"
     bot.send_document(
         chat_id=CONFESSION,
         data=message.document.file_id,
         caption=content,
         parse_mode='HTML',
     )
     reply = "<b>Document has been sent to the confession! Check the channel</b>"
     bot.reply_to(message, reply, parse_mode='HTML')
     pass
示例#5
0
 def __photo(message):
     bot.reply_to(message, "<b>Photo Received</b>", parse_mode='HTML')
     bot.send_chat_action(message.chat.id, 'upload_photo')
     content = f"<b>{random.choice(PERSON)} {random.choice(CONTENT)}.</b>"
     bot.send_photo(
         chat_id=CONFESSION,
         photo=message.photo[-1].file_id,
         caption=content,
         parse_mode='HTML',
     )
     reply = "<b>Photo has been sent to the confession! Check the channel</b>"
     bot.reply_to(message, reply, parse_mode='HTML')
     pass
示例#6
0
    def cmd_cloud_document(message):
        bot.reply_to(message, "<b>Document Received</b>", parse_mode='HTML')
        bot.send_chat_action(message.chat.id, 'upload_document')

        # bot.forward_message(config.ADMIN, message.chat.id, message.message_id)

        fileID = message.document.file_id
        file_info = bot.get_file(fileID)
        downloaded_file = bot.download_file(file_info.file_path)

        filename = message.document.file_name
        file = os.path.join(config.PATH['document'], filename)
        with open(file, 'wb') as new_file:
            new_file.write(downloaded_file)
        pass

        bot.reply_to(message, "<b>Status: </b>Document Saved\n<b>Name: </b>{0}\n<b>Location: </b>{1}".format(filename, file),
                     parse_mode='HTML')
示例#7
0
 def function_youtube(message):
     sleep(1)
     bot.reply_to(message, "<b>Download Started</b>", parse_mode='HTML')
     bot.send_chat_action(message.chat.id, 'upload_video')
     yt = YouTube(message.text)
     yt.streams\
         .filter(adaptive=True, file_extension='mp4')\
         .order_by('resolution')\
         .desc()\
         .first()\
         .download(config.PATH['youtube'])
     filename = config.PATH['youtube'] + '\\' + yt.title
     bot.reply_to(
         message,
         "<b>Status: </b>Video Saved\n<b>Name: </b>{0}\n<b>Location: </b>{1}"
         .format(yt.title, filename),
         parse_mode='HTML')
     sleep(3)
     bot.send_video(message.chat.id, filename)
示例#8
0
    def cmd_cloud_audio(message):
        bot.reply_to(message, "<b>Audio Received</b>", parse_mode='HTML')
        bot.send_chat_action(message.chat.id, 'upload_audio')

        # bot.forward_message(config.ADMIN, message.chat.id, message.message_id)

        fileID = message.audio.file_id
        file_info = bot.get_file(fileID)
        downloaded_file = bot.download_file(file_info.file_path)

        filename = message.audio.title + " - " + message.audio.performer + ".mp3"
        file = os.path.join(config.PATH['audio'], filename)
        with open(file, 'wb') as new_file:
            new_file.write(downloaded_file)
        pass

        bot.reply_to(
            message,
            "<b>Status: </b>Audio Saved\n<b>Name: </b>{0}\n<b>Location: </b>{1}"
            .format(filename, file),
            parse_mode='HTML')
示例#9
0
    def cmd_cloud_video(message):
        bot.reply_to(message, "<b>Video Received</b>", parse_mode='HTML')
        bot.send_chat_action(message.chat.id, 'upload_video')

        # bot.forward_message(config.ADMIN, message.chat.id, message.message_id)

        fileID = message.video.file_id
        file_info = bot.get_file(fileID)
        downloaded_file = bot.download_file(file_info.file_path)

        date = datetime.datetime.now()
        filename = str(date).replace(":", "-") + "-video.mp4"
        file = os.path.join(config.PATH['video'], filename)
        with open(file, 'wb') as new_file:
            new_file.write(downloaded_file)
        pass

        bot.reply_to(
            message,
            "<b>Status: </b>Video Saved\n<b>Name: </b>{0}\n<b>Location: </b>{1}"
            .format(filename, file),
            parse_mode='HTML')