Replaced legacy Union[] with new syntax

This commit is contained in:
2024-12-27 00:18:54 +01:00
parent 7b64f6938b
commit eed084cd91
6 changed files with 31 additions and 42 deletions

View File

@@ -1,5 +1,5 @@
import logging
from typing import Any, Dict, Union
from typing import Any, Dict
from discord import ApplicationContext, Embed, option, TextChannel, Role
from discord import utils as ds_utils
@@ -108,9 +108,7 @@ class CustomChannels(commands.Cog):
bots: Dict[str, Any] = await config_get("bots")
for bot in bots:
role: Union[Role, None] = ds_utils.get(
ctx.user.guild.roles, id=bots[bot]["role"]
)
role: Role | None = ds_utils.get(ctx.user.guild.roles, id=bots[bot]["role"])
if role is not None:
await created_channel.set_permissions(
@@ -131,7 +129,7 @@ class CustomChannels(commands.Cog):
) -> None:
holo_user_ctx: HoloUser = HoloUser(ctx.user)
custom_channel: Union[TextChannel, None] = ds_utils.get(
custom_channel: TextChannel | None = ds_utils.get(
ctx.guild.channels, id=holo_user_ctx.customchannel
)
@@ -188,7 +186,7 @@ class CustomChannels(commands.Cog):
await ctx.defer()
custom_channel: Union[TextChannel, None] = ds_utils.get(
custom_channel: TextChannel | None = ds_utils.get(
ctx.guild.channels, id=holo_user_ctx.customchannel
)