Replace channel name spaces to hyphens
This commit is contained in:
parent
a30ed6c85c
commit
4133bca460
4 changed files with 15 additions and 1 deletions
|
|
@ -365,6 +365,7 @@ class Bot:
|
|||
break
|
||||
if selected_category is None:
|
||||
selected_category = category_ranges[-1][2]
|
||||
self.logger.debug('Creating new channel: %s for id %s', subscription.name, subscription.channel_id)
|
||||
sub_channel = self.discord_manager.create_text_channel(
|
||||
self.guild_id, {
|
||||
'name': subscription.name,
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ class SubscriptionInfo:
|
|||
@staticmethod
|
||||
def discord_compatible_name(text: str) -> SubscriptionName:
|
||||
assert text, 'Channel name cannot be empty'
|
||||
return SubscriptionName(unidecode(text[:100]))
|
||||
return SubscriptionName(unidecode(text[:100].replace(' ', '-')))
|
||||
|
||||
@staticmethod
|
||||
def from_dict(info: dict) -> SubscriptionInfo:
|
||||
|
|
|
|||
BIN
tests/data/subscriptions.csv
(Stored with Git LFS)
Normal file
BIN
tests/data/subscriptions.csv
(Stored with Git LFS)
Normal file
Binary file not shown.
|
10
tests/test_youtube_subscription.py
Normal file
10
tests/test_youtube_subscription.py
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import logging
|
||||
from pathlib import Path
|
||||
|
||||
from breadtube_bot.youtube_subscription import SubscriptionHelper
|
||||
|
||||
|
||||
def test_helper():
|
||||
subscriptions = SubscriptionHelper.read_text(Path('tests/data/subscriptions.csv').read_bytes())
|
||||
assert subscriptions['UUlDye0T4xTEq46sA5evq9fA'].name == 'a-gauche'
|
||||
assert subscriptions['UUFrDDP81MX_QfOHrRZOgD4g'].name == 'l214'
|
||||
Loading…
Add table
Add a link
Reference in a new issue