adding channels and groups fixing
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
@@ -10,28 +10,26 @@ async def add_channel_start(update: Update, context: ContextTypes.DEFAULT_TYPE):
|
||||
if context.user_data is None:
|
||||
context.user_data = {}
|
||||
if update.message:
|
||||
await update.message.reply_text('Введите название канала (или "название ссылка" через пробел):')
|
||||
await update.message.reply_text('Введите имя канала:')
|
||||
return INPUT_NAME
|
||||
|
||||
async def input_channel_name(update: Update, context: ContextTypes.DEFAULT_TYPE):
|
||||
if context.user_data is None:
|
||||
context.user_data = {}
|
||||
text = update.message.text.strip() if update.message and update.message.text else ''
|
||||
if ' ' in text:
|
||||
name, link = text.split(' ', 1)
|
||||
context.user_data['channel_name'] = name
|
||||
context.user_data['channel_link'] = link
|
||||
return await save_channel(update, context)
|
||||
else:
|
||||
context.user_data['channel_name'] = text
|
||||
if update.message:
|
||||
await update.message.reply_text('Теперь отправьте ссылку на канал:')
|
||||
return INPUT_LINK
|
||||
context.user_data['channel_name'] = text
|
||||
if update.message:
|
||||
await update.message.reply_text('Теперь отправьте ссылку на канал (должна начинаться с @):')
|
||||
return INPUT_LINK
|
||||
|
||||
async def input_channel_link(update: Update, context: ContextTypes.DEFAULT_TYPE):
|
||||
if context.user_data is None:
|
||||
context.user_data = {}
|
||||
link = update.message.text.strip() if update.message and update.message.text else ''
|
||||
if not link.startswith('@'):
|
||||
if update.message:
|
||||
await update.message.reply_text('Ошибка: ссылка на канал должна начинаться с @. Попробуйте снова.')
|
||||
return INPUT_LINK
|
||||
context.user_data['channel_link'] = link
|
||||
return await save_channel(update, context)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user