From 714fcc9e1dc245eda6fc7cdd270f66a37df789f7 Mon Sep 17 00:00:00 2001 From: Migatu Date: Fri, 12 Apr 2024 13:41:44 +0200 Subject: [PATCH] Safeguard against commands being used in dms --- bot.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bot.py b/bot.py index 9ab9fc1..a49eb7e 100644 --- a/bot.py +++ b/bot.py @@ -342,9 +342,10 @@ async def on_message(message): if isinstance(message.channel, discord.DMChannel): channel = client.get_channel(1064888712565100614) await channel.send("Słyszałem ja żem że: " + message.content) + return else: channel = message.channel - await client.process_commands(message) + await client.process_commands(message) message.content = message.content.lower() @@ -1077,8 +1078,10 @@ async def get_file(ctx, source, link): dir_path = None item_type, item_id = spotify.parse_spotify_url(link) if item_id: - file_list = spotify.fetch_tracks(spotify_ctrl, item_type, link) - directory_name = spotify.get_item_name(spotify_ctrl, item_type, item_id) + coro = asyncio.to_thread(spotify.fetch_tracks, args=(spotify_ctrl, item_type, link)) + file_list = await coro + coro = asyncio.to_thread(spotify.get_item_name, args=(spotify_ctrl, item_type, item_id)) + directory_name = await coro url_data = {"urls": []} url_dict = {} url_dict["save_path"] = Path(