More reordering

This commit is contained in:
Trygve 2022-08-01 00:01:37 +02:00
parent 52bad09f7c
commit 8f9feebaf7

22
main.py
View File

@ -5,7 +5,7 @@ import yt_dlp
from config import config
class MyLogger(object):
class Logger(object):
def debug(self, msg):
pass
@ -29,6 +29,16 @@ def get_yt_vid_id(word):
else:
return False
creds = botlib.Creds(config['url'], config['username'], config['password'])
bot = botlib.Bot(creds)
ydl_opts = {
'format': config['yt_dlp_format'],
'outtmpl': config['download_dir'] + '/%(title)s.%(ext)s',
'restrictfilenames': True,
'logger': Logger(),
'progress_hooks': [progress_hook],
}
@bot.listener.on_message_event
async def youtube(room, message):
match = botlib.MessageMatch(room, message, bot)
@ -46,14 +56,4 @@ async def youtube(room, message):
except Exception as e:
await bot.api.send_text_message(room.room_id, str(e))
creds = botlib.Creds(config['url'], config['username'], config['password'])
bot = botlib.Bot(creds)
ydl_opts = {
'format': config['yt_dlp_format'],
'outtmpl': config['download_dir'] + '/%(title)s.%(ext)s',
'restrictfilenames': True,
'logger': MyLogger(),
'progress_hooks': [progress_hook],
}
bot.run()