From b6dd33b95673348cbee95a99d9a1c2806782280f Mon Sep 17 00:00:00 2001 From: geirawsm Date: Sat, 13 Jul 2024 22:13:56 +0200 Subject: [PATCH] Cleaning code and small fixes --- sausage_bot/cogs/log_maintenance.py | 1 + sausage_bot/cogs/roles.py | 4 ++++ sausage_bot/util/db_helper.py | 2 -- sausage_bot/util/feeds_core.py | 7 +++++-- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/sausage_bot/cogs/log_maintenance.py b/sausage_bot/cogs/log_maintenance.py index 24ccc6d..afe6d5b 100755 --- a/sausage_bot/cogs/log_maintenance.py +++ b/sausage_bot/cogs/log_maintenance.py @@ -190,6 +190,7 @@ async def log_maintenance(): select=('value'), where=('setting', 'limit') ) + settings_limit = int(settings_limit) log.debug(f'Got `settings_limit`: {settings_limit}') log.debug( f'Log limit is {settings_limit} in {settings_type}' diff --git a/sausage_bot/cogs/roles.py b/sausage_bot/cogs/roles.py index f95d284..b8a9370 100755 --- a/sausage_bot/cogs/roles.py +++ b/sausage_bot/cogs/roles.py @@ -1064,6 +1064,10 @@ async def add_reaction_message( ) ] ) + await interaction.followup.send( + 'Message added', ephemeral=True + ) + return return @commands.check_any( diff --git a/sausage_bot/util/db_helper.py b/sausage_bot/util/db_helper.py index 2d744bb..ec66402 100755 --- a/sausage_bot/util/db_helper.py +++ b/sausage_bot/util/db_helper.py @@ -667,8 +667,6 @@ async def get_output( out = out[0] else: out = await out.fetchall() - while len(out) == 1 and isinstance(out, (list, tuple)): - out = out[0] return out except aiosqlite.OperationalError as e: log.error(f'Error: {e}') diff --git a/sausage_bot/util/feeds_core.py b/sausage_bot/util/feeds_core.py index e5d546b..4e755f0 100755 --- a/sausage_bot/util/feeds_core.py +++ b/sausage_bot/util/feeds_core.py @@ -6,8 +6,9 @@ from uuid import uuid4 import discord + from sausage_bot.util import envs, datetime_handling, file_io, discord_commands -from sausage_bot.util import net_io, db_helper, config +from sausage_bot.util import net_io, db_helper from .log import log @@ -216,6 +217,7 @@ async def remove_feed_from_db(feed_type, feed_name): where=[('feed_name', feed_name)], single=True ) + log.debug(f'`uuid_from_db` is {uuid_from_db}') removal = await db_helper.del_row_by_AND_filter( feed_db, where=('uuid', uuid_from_db) @@ -324,6 +326,7 @@ def split_list(lst, chunk_size): ('feed_name', 'ASC') ] ) + log.debug(f'`feeds_out` is {feeds_out}') # Return None if empty db if feeds_out is None: log.log('No feeds in database') @@ -590,7 +593,7 @@ async def process_links_for_posting_or_editing( if FEED_POSTS is None: log.debug('`FEED_POSTS` is None') return None - for item in FEED_POSTS: + for item in FEED_POSTS[0:3]: log.verbose(f'Got this item:\n{item}') if isinstance(item, str): feed_link = item