async def check(e):
channels = [db.get('Settings', 'channel1'), db.get('Settings', 'channel2')]
found_channel = False
try:
if channels[i] != 'NOTSET':
for i in range(len(channels)):
await e.client.get_permissions(channels[i], e.sender_id)
found_channel = True
await func(e)
return
except:
pass
if found_channel:
channel_names = [channel for channel in channels if channel != 'NOTSET']
text = 'join to channels\n'
buttons = []
for channel_name in channel_names:
buttons.append([Button.url(f'🔗 join channel "{channel_name}"', f'https://t.me/{channel_name}')])
buttons.append([Button.url(' ok ✅', f'https://t.me/{BOTID}?start')])
await client.send_message(e.sender_id, text, buttons=buttons)
return check
this code when channels not set stop bot and don't work
Обсуждают сегодня