added video sending function from caption

This commit is contained in:
Ara0n 2022-01-11 00:12:03 +05:30
parent 3d342c9e2f
commit 985499abb6
4 changed files with 21 additions and 14 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@ botConfig.json
*.session
agentConfig.json
images
test.mp4

View File

@ -14,7 +14,7 @@
- Episode_id
# Happy Path
* /get and /getll
* /get and /getall
1. call a function videoFetcher(user_input).
2. the videoFetcher will check in mapping db if found return file_id
3. if the not found in mapping db will call downloadVideoService and it will return file_path,file_name,duration

View File

@ -16,7 +16,7 @@ API_TOKEN = configdata.get("bot_token")
def start(update,context):
update.message.reply_text(str(update.message.chat_id) + ": " + update.message.text)
update.message.reply_text("Hello there!")
def help(update,context):
@ -38,6 +38,7 @@ def get(update, context):
userdata = parse_search_query(userInput)
update.message.reply_text(f"Checking Internal Db\nAnime: {userdata.get('series')}\nSeason: {userdata.get('season_id')}\nEpisode: {userdata.get('episode_id')}")
else:
update.message.reply_text("Please refer to /help")
@ -56,7 +57,6 @@ def getall(update, context):
def error(update, context):
"""Log Errors caused by Updates."""
logger.warning('Update "%s" caused error "%s"', update, context.error)
@ -67,19 +67,25 @@ def check_document(update, context):
and returns a file id
'''
logger.info('check_document function is called!')
# these are from the file sent from the agent
user_id = update.message.from_user.id
if user_id == configdata.get('agent_user_id'):
file_id = update.message.video.file_id
caption = update.message.caption
end_user_chat_id = caption.split(":")[1]
end_user_chat_id = caption.split(":")[0]
#Keep in mind here i have to parse the chat_id from the caption above
update.message.send_document(end_user_chat_id,file_id)
context.bot.send_video(end_user_chat_id,file_id,supports_streaming=True)
def debug_message(update, context):
logger.info('debug_message function is called!')
update.message.reply_text('up')
user_id = update.message.from_user.id
update.message.reply_text(str(user_id))

View File

@ -70,6 +70,6 @@ async def main(argv):
if __name__ == '__main__':
import sys
asyncio.run(main())
asyncio.run(main(sys.argv[0:]))
# python uploader.py rainfall.mp4 rainfall chat_id narutos1ep34