diff --git a/sausage_bot/cogs/autoevent.py b/sausage_bot/cogs/autoevent.py index ca773b9..0680d78 100755 --- a/sausage_bot/cogs/autoevent.py +++ b/sausage_bot/cogs/autoevent.py @@ -145,7 +145,9 @@ async def event_add( ephemeral=True ) except (discord.HTTPException) as e: - log.error(envs.AUTOEVENT_HTTP_EXCEPTION_ERROR.format(e.text)) + log.error( + envs.AUTOEVENT_HTTP_EXCEPTION_ERROR.format(e.text) + ) if 'Cannot schedule event in the past' in str(e): log.log(envs.AUTOEVENT_EVENT_START_IN_PAST) # Delete command message diff --git a/sausage_bot/cogs/quote.py b/sausage_bot/cogs/quote.py index c54d391..48f815e 100755 --- a/sausage_bot/cogs/quote.py +++ b/sausage_bot/cogs/quote.py @@ -2,8 +2,6 @@ # -*- coding: UTF-8 -*- import discord from discord.ext import commands -from discord.utils import get -import typing import uuid from asyncio import TimeoutError @@ -177,7 +175,7 @@ async def on_submit(self, interaction: discord.Interaction): await interaction.response.send_message( # TODO i18n - f'Quote added', ephemeral=True + 'Quote added', ephemeral=True ) async def on_error(self, interaction: discord.Interaction, error): @@ -230,7 +228,7 @@ async def on_submit(self, interaction: discord.Interaction): await interaction.response.send_message( # TODO i18n - f'Quote edited', ephemeral=True + 'Quote edited', ephemeral=True ) async def on_error(self, interaction: discord.Interaction, error): diff --git a/sausage_bot/cogs/roles.py b/sausage_bot/cogs/roles.py index 1a29c99..75318a6 100755 --- a/sausage_bot/cogs/roles.py +++ b/sausage_bot/cogs/roles.py @@ -137,7 +137,8 @@ async def settings_autocomplete( ), value=str(setting[0]) ) - for setting in settings_in_list if current.lower() in setting[3].lower() + for setting in settings_in_list + if current.lower() in setting[3].lower() ] @@ -283,7 +284,6 @@ async def sync_reaction_message_from_settings( } # Edit discord message await msg_obj.edit( - #content=db_message[0][3], embed=discord.Embed.from_dict(embed_json) ) return @@ -1533,7 +1533,7 @@ async def add_settings( ] ) # TODO i18n - await interaction.followup.send(f'Added setting') + await interaction.followup.send('Added setting') return @commands.check_any( @@ -1563,7 +1563,7 @@ async def remove_settings( numbers=setting ) # TODO i18n - await interaction.followup.send(f'Removed setting') + await interaction.followup.send('Removed setting') return @commands.check_any( @@ -1571,7 +1571,7 @@ async def remove_settings( commands.has_permissions(manage_roles=True) ) @roles_settings_group.command( - name='list', description='List settings for roles on the server' + name='list', description='List settings for roles on the server' ) async def list_settings( self, interaction: discord.Interaction @@ -1593,7 +1593,9 @@ async def list_settings( _settings_db_expanded.append( (setting[0], _role, setting[1]) ) - _settings = tabulate(_settings_db_expanded, headers=['Setting', 'Role', 'Value']) + _settings = tabulate( + _settings_db_expanded, headers=['Setting', 'Role', 'Value'] + ) # TODO i18n await interaction.followup.send(f'```{_settings}```') return diff --git a/sausage_bot/cogs/stats.py b/sausage_bot/cogs/stats.py index be4ace1..89aa5f9 100755 --- a/sausage_bot/cogs/stats.py +++ b/sausage_bot/cogs/stats.py @@ -36,7 +36,6 @@ async def hidden_roles_autocomplete( interaction: discord.Interaction, current: str, ) -> list[discord.app_commands.Choice[str]]: - hidden_roles_in_db = await db_helper.get_output( template_info=envs.stats_db_hide_roles_schema, get_row_ids=True @@ -445,8 +444,12 @@ async def tabify( if role != '@everyone': # Check for `sort_min_role_members` if stats_settings['sort_min_role_members']: - min_members = stats_settings['sort_min_role_members'] - if dict_in[role]['members'] >= int(min_members): + min_members = stats_settings[ + 'sort_min_role_members' + ] + if dict_in[role]['members'] >= int( + min_members + ): dict_out['name'].append( dict_in[role]['name']) dict_out['members'].append( diff --git a/sausage_bot/cogs/youtube.py b/sausage_bot/cogs/youtube.py index a096cc3..a0699ea 100755 --- a/sausage_bot/cogs/youtube.py +++ b/sausage_bot/cogs/youtube.py @@ -472,11 +472,13 @@ async def setup(bot): ) youtube_filter_prep_is_ok = await db_helper.prep_table( envs.youtube_db_filter_schema, - youtube_inserts['filter'] if youtube_inserts is not None else youtube_inserts + youtube_inserts['filter'] + if youtube_inserts is not None else youtube_inserts ) youtube_log_prep_is_ok = await db_helper.prep_table( envs.youtube_db_log_schema, - youtube_inserts['logs'] if youtube_inserts is not None else youtube_inserts + youtube_inserts['logs'] + if youtube_inserts is not None else youtube_inserts ) log.verbose(f'`youtube_prep_is_ok` is {youtube_prep_is_ok}') log.verbose( diff --git a/sausage_bot/util/discord_commands.py b/sausage_bot/util/discord_commands.py index aec3b5a..601e8d9 100755 --- a/sausage_bot/util/discord_commands.py +++ b/sausage_bot/util/discord_commands.py @@ -302,7 +302,9 @@ async def remove_stats_post(stats_channel): if str(msg.author.id) == config.BOT_ID: if 'Serverstats sist' in str(msg.content): # TODO var msg - log.debug('Found post with `Serverstats sist`, removing...') + log.debug( + 'Found post with `Serverstats sist`, removing...' + ) await msg.delete() found_stats_msg = True return diff --git a/sausage_bot/util/feeds_core.py b/sausage_bot/util/feeds_core.py index 9d9fad0..afb8065 100755 --- a/sausage_bot/util/feeds_core.py +++ b/sausage_bot/util/feeds_core.py @@ -157,7 +157,7 @@ async def add_to_feed_db( test_link = await net_io.get_link(feed_link) if not args.rss_skip_url_validation: if test_link is None: - log.verbose(f'`test_link` is None') + log.verbose('`test_link` is None') return None elif isinstance(test_link, int): log.verbose(f'`test_link` returns code {test_link}') @@ -530,14 +530,14 @@ async def review_feeds_status(feed_type: str = None): failed_channels.append([FEED_NAME, CHANNEL]) if len(failed_feeds) > 0: # TODO i18n - feed_error_msg = f'Følgende feeds hadde feil ved henting av '\ + feed_error_msg = 'Følgende feeds hadde feil ved henting av '\ 'linker:\n- {}'.format( '\n- '.join(failed_feeds) ) await discord_commands.log_to_bot_channel(feed_error_msg) if len(failed_channels) > 0: # TODO i18n - channel_error_msg = f'Følgende feeds hadde feil ved posting til '\ + channel_error_msg = 'Følgende feeds hadde feil ved posting til '\ 'valgte kanaler:\n- {}'.format( '\n- '.join(f'{failed_channels[0]}: {failed_channels[1]}') ) @@ -562,9 +562,9 @@ def link_similar_to_logged_post(link: str, feed_log: list): ''' for log_item in feed_log: if file_io.check_similarity(log_item[0], link): - log.debug(f'Found similar link log)') + log.debug('Found similar link log)') return True - log.debug(f'No similar link found') + log.debug('No similar link found') return False @@ -664,7 +664,7 @@ async def process_links_for_posting_or_editing( embed.set_image(url=item['img']) embed.set_footer(text=item['pod_description']) log.debug( - f'Sending this embed to channel: ', pretty=embed + 'Sending this embed to channel: ', pretty=embed ) await discord_commands.post_to_channel( CHANNEL, embed_in=embed diff --git a/sausage_bot/util/net_io.py b/sausage_bot/util/net_io.py index 1439dc5..3093bb9 100755 --- a/sausage_bot/util/net_io.py +++ b/sausage_bot/util/net_io.py @@ -68,7 +68,7 @@ async def check_spotify_podcast(url): pod_id = re.search(r'.*/show/([a-zA-Z0-9]+).*', url).group(1) try: _show = _spotipy.show(pod_id) - log.debug(f'`_show`: ', pretty=_show) + log.debug('`_show`: ', pretty=_show) return _show except Exception as e: log.error(f'ERROR: {e}') @@ -120,7 +120,7 @@ async def get_spotify_podcast_links(feed): temp_info['img'] = ep['images'][0]['url'] temp_info['id'] = ep['id'] temp_info['duration'] = ep['duration_ms'] * 1000 - log.verbose(f'Populated `temp_info`: ', pretty=temp_info) + log.verbose('Populated `temp_info`: ', pretty=temp_info) items_out['items'].append(temp_info) log.debug( 'len of `items_out[\'items\']` is {}'.format( @@ -252,7 +252,9 @@ async def make_event_start_stop(date, time=None): try: start_date = await datetime_handling.get_dt('date', dt=start_dt) log.debug(f'Making `start_date` {start_date}') - start_time = await datetime_handling.get_dt('time', sep=':', dt=start_dt) + start_time = await datetime_handling.get_dt( + 'time', sep=':', dt=start_dt + ) log.debug(f'Making `start_time` {start_time}') # Make a startdate for the event that starts 30 minutes before # the match @@ -262,7 +264,9 @@ async def make_event_start_stop(date, time=None): log.debug(f'`start_event` is {start_event}') # Make an enddate for the event that should stop approximately # 30 minutes after the match is over - end_dt = await datetime_handling.change_dt(start_dt, 'add', 2.5, 'hours') + end_dt = await datetime_handling.change_dt( + start_dt, 'add', 2.5, 'hours' + ) log.debug(f'`end_dt` is {end_dt}') # Make the epochs that the event will use event_start_epoch = await datetime_handling.get_dt(dt=start_event)