Skip to content

Commit

Permalink
Update dependencies and formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Drapersniper committed Jun 18, 2024
1 parent 097ba5b commit fc00205
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 77 deletions.
18 changes: 9 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ default_language_version:
exclude: ^.*\.po$
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
# Checks for git-related issues
- id: check-case-conflict
Expand Down Expand Up @@ -33,7 +33,7 @@ repos:
- id: check-json
- id: check-symlinks
- repo: https://github.com/PyCQA/autoflake
rev: v2.2.1
rev: v2.3.1
hooks:
- id: autoflake
args: [--remove-all-unused-imports, --recursive, --in-place, --remove-unused-variables, --ignore-init-module-imports, --remove-duplicate-keys]
Expand All @@ -42,7 +42,7 @@ repos:
hooks:
- id: absolufy-imports
- repo: https://github.com/pycqa/flake8
rev: 6.1.0
rev: 7.1.0
hooks:
- id: flake8
additional_dependencies: [flake8-print]
Expand All @@ -61,12 +61,12 @@ repos:
- id: upgrade-type-hints
args: [--futures=true]
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.27.0
rev: 0.28.5
hooks:
- id: check-github-actions
- id: check-dependabot
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.10.0
rev: v2.13.0
hooks:
- id: pretty-format-yaml
args: [--autofix, --indent, '4']
Expand All @@ -75,23 +75,23 @@ repos:
hooks:
- id: blacken-docs
- repo: https://github.com/pycqa/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
- repo: https://github.com/MarcoGorelli/auto-walrus
rev: v0.2.2
rev: 0.3.4
hooks:
- id: auto-walrus
args: [--line-length, '120']
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
rev: v3.16.0
hooks:
- id: pyupgrade
args: [--py311-plus]
- repo: https://github.com/psf/black
# The `refs/tags/<tag>:refs/tags/<tag>` is needed for black's required-version to work:
# https://github.com/psf/black/issues/2493#issuecomment-1081987650
rev: 23.9.1
rev: 24.4.2
hooks:
- id: black
- repo: https://github.com/Pierre-Sassoulas/black-disable-checker
Expand Down
68 changes: 41 additions & 27 deletions audio/config_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,11 @@ async def command_playerset_global_deafen(self, context: PyLavContext, toggle: b
await self.pylav.player_manager.global_config.update_self_deaf(toggle)
await context.send(
embed=await self.pylav.construct_embed(
description=_("From now on, I will deafen myself when joining a voice channel.")
if toggle
else _("From now on, I will no longer deafen myself when joining a voice channel."),
description=(
_("From now on, I will deafen myself when joining a voice channel.")
if toggle
else _("From now on, I will no longer deafen myself when joining a voice channel.")
),
messageable=context,
),
ephemeral=True,
Expand All @@ -192,9 +194,11 @@ async def command_playerset_global_autoshuffle(self, context: PyLavContext, togg
await self.pylav.player_manager.global_config.update_auto_shuffle(toggle)
await context.send(
embed=await self.pylav.construct_embed(
description=_("From now on, I will auto shuffle my track queue when new songs are added.")
if toggle
else _("From now on, I will no longer auto shuffle my track queue when new songs are added."),
description=(
_("From now on, I will auto shuffle my track queue when new songs are added.")
if toggle
else _("From now on, I will no longer auto shuffle my track queue when new songs are added.")
),
messageable=context,
),
ephemeral=True,
Expand All @@ -212,9 +216,11 @@ async def command_playerset_global_shuffle(self, context: PyLavContext, toggle:
await self.pylav.player_manager.global_config.update_shuffle(toggle)
await context.send(
embed=await self.pylav.construct_embed(
description=_("From now on, I will allow users to shuffle the queue.")
if toggle
else _("From now on, I will no longer allow users to shuffle the queue."),
description=(
_("From now on, I will allow users to shuffle the queue.")
if toggle
else _("From now on, I will no longer allow users to shuffle the queue.")
),
messageable=context,
),
ephemeral=True,
Expand All @@ -231,12 +237,14 @@ async def command_playerset_global_auto(self, context: PyLavContext, toggle: boo
await self.pylav.player_manager.global_config.update_auto_play(toggle)
await context.send(
embed=await self.pylav.construct_embed(
description=_(
"From now on, I will automatically play songs from the specified playlist when the queue is empty."
)
if toggle
else _(
"From now on, I will no longer automatically play songs from the specified playlist when the queue is empty."
description=(
_(
"From now on, I will automatically play songs from the specified playlist when the queue is empty."
)
if toggle
else _(
"From now on, I will no longer automatically play songs from the specified playlist when the queue is empty."
)
),
messageable=context,
),
Expand Down Expand Up @@ -702,9 +710,11 @@ async def command_playerset_server_deafen(self, context: PyLavContext, toggle: b
await config.update_self_deaf(toggle)
await context.send(
embed=await self.pylav.construct_embed(
description=_("I will deafen myself when joining voice channels on this server.")
if toggle
else _("I will no longer deafen myself when joining voice channels on this server."),
description=(
_("I will deafen myself when joining voice channels on this server.")
if toggle
else _("I will no longer deafen myself when joining voice channels on this server.")
),
messageable=context,
),
ephemeral=True,
Expand Down Expand Up @@ -734,9 +744,11 @@ async def command_playerset_server_autoshuffle(self, context: PyLavContext, togg
await config.update_auto_shuffle(toggle)
await context.send(
embed=await self.pylav.construct_embed(
description=_("Auto shuffle turned on for this server.")
if toggle
else _("Auto shuffle turned off for this server."),
description=(
_("Auto shuffle turned on for this server.")
if toggle
else _("Auto shuffle turned off for this server.")
),
messageable=context,
),
ephemeral=True,
Expand Down Expand Up @@ -767,9 +779,9 @@ async def command_playerset_server_shuffle(self, context: PyLavContext, toggle:
await config.update_shuffle(toggle)
await context.send(
embed=await self.pylav.construct_embed(
description=_("Shuffling turned on for this server.")
if toggle
else _("Shuffling turned off for this server."),
description=(
_("Shuffling turned on for this server.") if toggle else _("Shuffling turned off for this server.")
),
messageable=context,
),
ephemeral=True,
Expand Down Expand Up @@ -803,9 +815,11 @@ async def command_playerset_server_auto(self, context: PyLavContext, toggle: boo
await config.update_auto_play(toggle)
await context.send(
embed=await self.pylav.construct_embed(
description=_("From now on, I will automatically play songs when the queue is empty.")
if toggle
else _("From now on, I will no longer automatically play songs when the queue is empty."),
description=(
_("From now on, I will automatically play songs when the queue is empty.")
if toggle
else _("From now on, I will no longer automatically play songs when the queue is empty.")
),
messageable=context,
),
ephemeral=True,
Expand Down
16 changes: 10 additions & 6 deletions audio/context_menus.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,11 @@ async def _context_message_play(self, interaction: DISCORD_INTERACTION_TYPE, mes
description=_(
"This command is unavailable in this channel. Please use {channel_name_variable_do_not_translate} instead."
).format(
channel_name_variable_do_not_translate=channel.mention
if (channel := interaction.guild.get_channel_or_thread(channel_id))
else channel_id
channel_name_variable_do_not_translate=(
channel.mention
if (channel := interaction.guild.get_channel_or_thread(channel_id))
else channel_id
)
),
),
ephemeral=True,
Expand Down Expand Up @@ -167,9 +169,11 @@ async def _context_user_play(
description=_(
"This command is unavailable in this channel. Please use {channel_name_variable_do_not_translate} instead."
).format(
channel_name_variable_do_not_translate=channel.mention
if (channel := interaction.guild.get_channel_or_thread(channel_id))
else channel_id
channel_name_variable_do_not_translate=(
channel.mention
if (channel := interaction.guild.get_channel_or_thread(channel_id))
else channel_id
)
),
),
ephemeral=True,
Expand Down
48 changes: 29 additions & 19 deletions plconfig/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,12 +291,14 @@ async def generate_server_player_config_embed(self) -> discord.Embed: # sourcer
dj_user_str = (
"\n".join(
[
EightBitANSI.colorize(
discord.utils.escape_markdown(str(member_obj)),
color=EightBitANSI.closest_color(*member_obj.color.to_rgb()),
(
EightBitANSI.colorize(
discord.utils.escape_markdown(str(member_obj)),
color=EightBitANSI.closest_color(*member_obj.color.to_rgb()),
)
if (member_obj := self.context.guild.get_member(user))
else EightBitANSI.paint_green(user)
)
if (member_obj := self.context.guild.get_member(user))
else EightBitANSI.paint_green(user)
for user in config["dj_users"]
]
)
Expand All @@ -309,12 +311,14 @@ async def generate_server_player_config_embed(self) -> discord.Embed: # sourcer
dj_role_str = (
"\n".join(
[
EightBitANSI.colorize(
discord.utils.escape_markdown(str(role_obj)),
color=EightBitANSI.closest_color(*role_obj.color.to_rgb()),
(
EightBitANSI.colorize(
discord.utils.escape_markdown(str(role_obj)),
color=EightBitANSI.closest_color(*role_obj.color.to_rgb()),
)
if (role_obj := self.context.guild.get_role(role))
else EightBitANSI.paint_green(role)
)
if (role_obj := self.context.guild.get_role(role))
else EightBitANSI.paint_green(role)
for role in config["dj_roles"]
]
)
Expand Down Expand Up @@ -429,21 +433,27 @@ async def generate_server_player_config_embed(self) -> discord.Embed: # sourcer
(EightBitANSI.paint_white(_("Auto Alone Disconnect")), auto_alone_dc_message),
(
EightBitANSI.paint_white(_("Forced Voice Channel")),
EightBitANSI.paint_green(config["forced_channel_id"])
if config["forced_channel_id"] != 0
else EightBitANSI.paint_red(_("None")),
(
EightBitANSI.paint_green(config["forced_channel_id"])
if config["forced_channel_id"] != 0
else EightBitANSI.paint_red(_("None"))
),
),
(
EightBitANSI.paint_white(_("Forced Command Channel")),
EightBitANSI.paint_green(config["text_channel_id"])
if config["text_channel_id"] != 0
else EightBitANSI.paint_red(_("None")),
(
EightBitANSI.paint_green(config["text_channel_id"])
if config["text_channel_id"] != 0
else EightBitANSI.paint_red(_("None"))
),
),
(
EightBitANSI.paint_white(_("Forced Notification Channel")),
EightBitANSI.paint_green(config["notify_channel_id"])
if config["notify_channel_id"] != 0
else EightBitANSI.paint_red(_("None")),
(
EightBitANSI.paint_green(config["notify_channel_id"])
if config["notify_channel_id"] != 0
else EightBitANSI.paint_red(_("None"))
),
),
(EightBitANSI.paint_white(_("Disc Jockey Users")), dj_user_str),
(EightBitANSI.paint_white(_("Disc Jockey Roles")), dj_role_str),
Expand Down
8 changes: 5 additions & 3 deletions pleffects/cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -977,9 +977,11 @@ async def slash_fx_show(self, interaction: DISCORD_INTERACTION_TYPE) -> None:
embed=await self.pylav.construct_embed(
title=_("Current filters applied to the player"),
description="__**{translation}:**__\n{data}".format(
data=box(tabulate(data, headers="keys", tablefmt="fancy_grid", maxcolwidths=[10, 18]), lang="ansi") # type: ignore
if data
else _("None"),
data=(
box(tabulate(data, headers="keys", tablefmt="fancy_grid", maxcolwidths=[10, 18]), lang="ansi") # type: ignore
if data
else _("None")
),
translation=discord.utils.escape_markdown(_("Currently Applied")),
),
messageable=context,
Expand Down
24 changes: 11 additions & 13 deletions plnotifier/cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,9 @@ def __init__(self, bot: DISCORD_BOT_TYPE, *args, **kwargs):
webhook_url=None,
webhook_channel_id=None,
)
self._message_queue: dict[
discord.TextChannel | discord.VoiceChannel | discord.Thread, list[discord.Embed]
] = defaultdict(list)
self._message_queue: dict[discord.TextChannel | discord.VoiceChannel | discord.Thread, list[discord.Embed]] = (
defaultdict(list)
)
self._scheduled_jobs: list[Job] = []
self._webhook_cache: dict[int, discord.Webhook] = {}
self._session = aiohttp.ClientSession(json_serialize=json.dumps, auto_decompress=False)
Expand Down Expand Up @@ -436,11 +436,9 @@ async def command_plnotify_event(
).format(
event_variable_do_not_translate=inline(event),
toggle_variable_do_not_translate=_("notify") if toggle else _("do not notify"),
extras_variable_do_not_translate=_(" with mentions")
if use_mention and toggle
else _(" without mentions")
if toggle
else "",
extras_variable_do_not_translate=(
_(" with mentions") if use_mention and toggle else _(" without mentions") if toggle else ""
),
),
messageable=context,
),
Expand Down Expand Up @@ -1491,11 +1489,11 @@ async def on_pylav_queue_tracks_added_event(self, event: QueueTracksAddedEvent)
description=_(
"[Node={node_variable_do_not_translate}] {requester_variable_do_not_translate} added {track_count_variable_do_not_translate} to the queue."
).format(
track_count_variable_do_not_translate=_("{count_variable_do_not_translate} track").format(
count_variable_do_not_translate=count
)
if (count := len(event.tracks)) > 1
else await event.tracks[0].get_track_display_name(with_url=True),
track_count_variable_do_not_translate=(
_("{count_variable_do_not_translate} track").format(count_variable_do_not_translate=count)
if (count := len(event.tracks)) > 1
else await event.tracks[0].get_track_display_name(with_url=True)
),
requester_variable_do_not_translate=user,
node_variable_do_not_translate=event.player.node.name,
),
Expand Down

0 comments on commit fc00205

Please sign in to comment.