mirror of
https://github.com/Araon/Meido.git
synced 2025-02-20 11:13:20 +08:00
minor fixes
This commit is contained in:
parent
65f0ba3e2e
commit
cdf26f1425
@ -1,3 +1,6 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import json
|
import json
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
@ -14,15 +17,15 @@ BOT_VERSION = 0.1
|
|||||||
logging.basicConfig(format='%(levelname)s - %(asctime)s - %(name)s - %(message)s', level=logging.INFO)
|
logging.basicConfig(format='%(levelname)s - %(asctime)s - %(name)s - %(message)s', level=logging.INFO)
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
#fetching config file
|
||||||
try:
|
try:
|
||||||
with open('bot/config/botConfig.json', 'w+') as config:
|
with open('bot/config/botConfig.json', 'w+') as config:
|
||||||
configdata = json.load(config)
|
configdata = json.load(config)
|
||||||
except:
|
except Exception as e:
|
||||||
raise Exception('CONFIG FILE NOT FOUND!')
|
raise Exception('CONFIG FILE NOT FOUND!')
|
||||||
|
|
||||||
API_TOKEN = configdata.get("bot_token")
|
API_TOKEN = configdata.get("bot_token")
|
||||||
|
|
||||||
|
|
||||||
def start(update,context):
|
def start(update,context):
|
||||||
update.message.reply_text(f"Thanks for using Araon Bot({BOT_VERSION})\nThis is a alpha built so expect delayed response and many bugs\nIf you spot any issue feel free to reach out")
|
update.message.reply_text(f"Thanks for using Araon Bot({BOT_VERSION})\nThis is a alpha built so expect delayed response and many bugs\nIf you spot any issue feel free to reach out")
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
#https://sudonull.com/post/62683-Telegram-bots-Uploading-files-larger-than-50mb
|
#https://sudonull.com/post/62683-Telegram-bots-Uploading-files-larger-than-50mb
|
||||||
|
|
||||||
'''
|
'''
|
||||||
@ -12,20 +13,21 @@ the agent must send the bot this file
|
|||||||
then the bot will receive own file_id for this file and will be able to dispose of it.
|
then the bot will receive own file_id for this file and will be able to dispose of it.
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from telethon import TelegramClient
|
from telethon import TelegramClient
|
||||||
from telethon.tl.types import DocumentAttributeVideo
|
from telethon.tl.types import DocumentAttributeVideo
|
||||||
import asyncio
|
import asyncio
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
# basic logging
|
||||||
logging.basicConfig(format='%(levelname)s - %(asctime)s - %(name)s - %(message)s', level=logging.INFO)
|
logging.basicConfig(format='%(levelname)s - %(asctime)s - %(name)s - %(message)s', level=logging.INFO)
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with open('uploaderService/config/agentConfig.json', 'w+') as config:
|
with open('uploaderService/config/agentConfig.json', 'w+') as config:
|
||||||
configdata = json.load(config)
|
configdata = json.load(config)
|
||||||
except:
|
except Exception as e:
|
||||||
raise Exception('CONFIG FILE NOT FOUND!')
|
raise Exception('CONFIG FILE NOT FOUND!')
|
||||||
|
|
||||||
|
|
||||||
@ -37,14 +39,10 @@ phone = configdata.get('phone')
|
|||||||
bot_name = configdata.get('bot_name')
|
bot_name = configdata.get('bot_name')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async def callback(current, total):
|
async def callback(current, total):
|
||||||
# for upload progression
|
# for upload progression
|
||||||
logger.info('Uploaded: {:.2%}'.format(current / total))
|
logger.info('Uploaded: {:.2%}'.format(current / total))
|
||||||
|
|
||||||
|
|
||||||
'''
|
'''
|
||||||
bot_name = the actual bot name
|
bot_name = the actual bot name
|
||||||
file_path = where the file is downloaded
|
file_path = where the file is downloaded
|
||||||
@ -57,7 +55,8 @@ async def uploadVideo(bot_name,file_path,chat_id,object_id):
|
|||||||
logger.info('video uploading initiated')
|
logger.info('video uploading initiated')
|
||||||
async with TelegramClient(entity, api_id, api_hash) as client:
|
async with TelegramClient(entity, api_id, api_hash) as client:
|
||||||
if not await client.is_user_authorized():
|
if not await client.is_user_authorized():
|
||||||
#await client.send_code_request(phone) #at the first start - uncomment, after authorization to avoid FloodWait I advise you to comment
|
#await client.send_code_request(phone)
|
||||||
|
'''at the first start - uncomment, after authorization to avoid FloodWait I advise you to comment'''
|
||||||
await client.sign_in(phone, input('Enter code: '))
|
await client.sign_in(phone, input('Enter code: '))
|
||||||
await client.send_file(
|
await client.send_file(
|
||||||
str(bot_name),
|
str(bot_name),
|
||||||
@ -83,4 +82,4 @@ if __name__ == '__main__':
|
|||||||
import sys
|
import sys
|
||||||
asyncio.run(main(sys.argv[0:]))
|
asyncio.run(main(sys.argv[0:]))
|
||||||
|
|
||||||
# python uploader.py rainfall.mp4 rainfall chat_id narutos1ep34
|
# python uploader.py <file_path> <caption> <chat_id> <object_id>
|
Loading…
x
Reference in New Issue
Block a user