Clean up downloads user requests bot shut-down

* Basically for Ctrl + C
Signed-off-by: lzzy12 <jhashivam2020@gmail.com>
This commit is contained in:
lzzy12 2019-09-26 18:22:58 +05:30
parent ab6c01146e
commit f0efb4357d
2 changed files with 6 additions and 4 deletions

View File

@ -3,7 +3,6 @@ import configparser
import aria2p
from telegram.ext import Updater
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
level=logging.INFO)
@ -31,8 +30,7 @@ aria2 = aria2p.API(
secret="",
)
)
aria2.autopurge()
aria2.remove_all(True)
DOWNLOAD_DIR = None
BOT_TOKEN = None
try:

View File

@ -1,6 +1,8 @@
from telegram.ext import CommandHandler, run_async
from bot import dispatcher, LOGGER, updater
from bot import dispatcher, LOGGER, updater, aria2
import bot.mirror
from bot.helper import fs_utils
import signal
@run_async
@ -13,10 +15,12 @@ LOGGER.info('__main__.py')
def main():
start_handler = CommandHandler('start', start)
dispatcher.add_handler(start_handler)
LOGGER.info("Bot Started!")
updater.start_polling()
signal.signal(signal.SIGINT, fs_utils.exit_clean_up)
main()