mirror of
https://github.com/Araon/Meido.git
synced 2025-02-20 11:13:20 +08:00
added video sending function from caption
This commit is contained in:
parent
3d342c9e2f
commit
985499abb6
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,4 +1,5 @@
|
|||||||
botConfig.json
|
botConfig.json
|
||||||
*.session
|
*.session
|
||||||
agentConfig.json
|
agentConfig.json
|
||||||
images
|
images
|
||||||
|
test.mp4
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
- Episode_id
|
- Episode_id
|
||||||
|
|
||||||
# Happy Path
|
# Happy Path
|
||||||
* /get and /getll
|
* /get and /getall
|
||||||
1. call a function videoFetcher(user_input).
|
1. call a function videoFetcher(user_input).
|
||||||
2. the videoFetcher will check in mapping db if found return file_id
|
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
|
3. if the not found in mapping db will call downloadVideoService and it will return file_path,file_name,duration
|
||||||
|
28
bot/bot.py
28
bot/bot.py
@ -16,7 +16,7 @@ API_TOKEN = configdata.get("bot_token")
|
|||||||
|
|
||||||
|
|
||||||
def start(update,context):
|
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):
|
def help(update,context):
|
||||||
@ -38,6 +38,7 @@ def get(update, context):
|
|||||||
userdata = parse_search_query(userInput)
|
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')}")
|
update.message.reply_text(f"Checking Internal Db\nAnime: {userdata.get('series')}\nSeason: {userdata.get('season_id')}\nEpisode: {userdata.get('episode_id')}")
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
update.message.reply_text("Please refer to /help")
|
update.message.reply_text("Please refer to /help")
|
||||||
|
|
||||||
@ -56,7 +57,6 @@ def getall(update, context):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def error(update, context):
|
def error(update, context):
|
||||||
"""Log Errors caused by Updates."""
|
"""Log Errors caused by Updates."""
|
||||||
logger.warning('Update "%s" caused error "%s"', update, context.error)
|
logger.warning('Update "%s" caused error "%s"', update, context.error)
|
||||||
@ -67,19 +67,25 @@ def check_document(update, context):
|
|||||||
and returns a file id
|
and returns a file id
|
||||||
'''
|
'''
|
||||||
logger.info('check_document function is called!')
|
logger.info('check_document function is called!')
|
||||||
# these are from the file sent from the agent
|
user_id = update.message.from_user.id
|
||||||
file_id = update.message.video.file_id
|
|
||||||
caption = update.message.caption
|
|
||||||
|
|
||||||
end_user_chat_id = caption.split(":")[1]
|
if user_id == configdata.get('agent_user_id'):
|
||||||
|
file_id = update.message.video.file_id
|
||||||
#Keep in mind here i have to parse the chat_id from the caption above
|
caption = update.message.caption
|
||||||
update.message.send_document(end_user_chat_id,file_id)
|
end_user_chat_id = caption.split(":")[0]
|
||||||
|
#Keep in mind here i have to parse the chat_id from the caption above
|
||||||
|
context.bot.send_video(end_user_chat_id,file_id,supports_streaming=True)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def debug_message(update, context):
|
def debug_message(update, context):
|
||||||
logger.info('debug_message function is called!')
|
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))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -70,6 +70,6 @@ async def main(argv):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
import sys
|
import sys
|
||||||
asyncio.run(main())
|
asyncio.run(main(sys.argv[0:]))
|
||||||
|
|
||||||
# python uploader.py rainfall.mp4 rainfall chat_id narutos1ep34
|
# python uploader.py rainfall.mp4 rainfall chat_id narutos1ep34
|
Loading…
x
Reference in New Issue
Block a user