Fix discord channel name sanitization
This commit is contained in:
parent
45731bda80
commit
a30ed6c85c
1 changed files with 3 additions and 5 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue