fix(main.py): handle case when skip_channel_default setting is provided and is not None, by loading the specified channel instead of prompting the user for input

feat(main.py): add support for skip_channel_default setting to skip the channel selection prompt and load a specific channel automatically
This commit is contained in:
Paillat
2023-07-22 11:36:53 +02:00
parent 0943f61c0b
commit ea0c6968f5

10
main.py
View File

@@ -86,6 +86,16 @@ async def main():
printm("It looks like you don't have any channels yet. Let's create one!") printm("It looks like you don't have any channels yet. Let's create one!")
channel = Channel() channel = Channel()
await channel.create() await channel.create()
else:
if settings.skip_channel_default != None:
if type(settings.skip_channel_default) == str:
channel_name = settings.skip_channel_default
elif type(settings.skip_channel_default) == int:
channel_name = channels[settings.skip_channel_default]
else:
raise TypeError("The skip_channel_default setting must be either a string or an integer.")
channel = Channel()
await channel.load(channel_name)
else: else:
printm("Here are your channels:") printm("Here are your channels:")
for i, channel in enumerate(channels): for i, channel in enumerate(channels):