From a30ed6c85cd187ded8a121158f7ddaf78c0fcfed Mon Sep 17 00:00:00 2001 From: BreadTube Date: Mon, 25 May 2026 00:11:13 +0900 Subject: [PATCH] Fix discord channel name sanitization --- breadtube_bot/bot.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/breadtube_bot/bot.py b/breadtube_bot/bot.py index c25cec4..ca0cc28 100644 --- a/breadtube_bot/bot.py +++ b/breadtube_bot/bot.py @@ -24,7 +24,6 @@ from .youtube_subscription import ( class Bot: DEFAULT_MESSAGE_LIST_LIMIT: int = 50 - DISCORD_NAME_REGEX: str = r'([^a-z])' INIT_MESSAGE: str = ('Bot initialized.\nThis is the current configuration used.\n' 'You can upload a new one to update the configuration.') MAX_DOWNLOAD_SIZE: int = 50_000 @@ -356,9 +355,8 @@ class Bot: def _get_subscription_channel(self, subscription: SubscriptionInfo, channel_dict: dict[str, TextChannel], category_ranges: list[tuple[int, int, ChannelCategory]]) -> TextChannel: - discord_name = re.sub(self.DISCORD_NAME_REGEX, '-', subscription.name.lower()) - category_value = ord(discord_name[0]) - sub_channel: TextChannel | None = channel_dict.get(discord_name) + category_value = ord(subscription.name[0]) + sub_channel: TextChannel | None = channel_dict.get(subscription.name) if sub_channel is None: selected_category: ChannelCategory | None = None for start_range, stop_range, category in category_ranges: @@ -369,7 +367,7 @@ class Bot: selected_category = category_ranges[-1][2] sub_channel = self.discord_manager.create_text_channel( self.guild_id, { - 'name': discord_name, + 'name': subscription.name, 'parent_id': selected_category.id, 'permission_overwrites': [ Overwrite(self.everyone_role.id, OverwriteType.ROLE, allow=Permissions.NONE,