*main.py*
...
@dp.message_handler(commands=['start'])
async def start(message: types.Message):
await message.delete()
connect = sqlite3.connect(r'C:\obamabot\base.db')
db = connect.cursor()
db.execute("SELECT language FROM users WHERE id = ?;", (message.from_user.id,))
data = db.fetchone()
if data is not None:
lang = data[0]
if lang == 'ru':
await bases.login(message)
await ru.ru_bot(message)
connect.commit()
connect.close()
elif lang == 'uk':
pass
else:
pass
else:
print(data)
if __name__ == '__main__':
from aiogram import executor
executor.start_polling(dp, skip_updates=True)
...
*ru.py*
...
@dp.message_handler()
async def ru_bot(message: types.Message):
stkb = await inlines.start_kb_ru()
hi_stick = await message.answer_sticker(sticker='CAACAgIAAxkBAAIB5mWULDDVy6iRndrHiSOZaKo3L9eNAALmPQACddihSAQdg_51tWFuNAQ')
hi_mess = await message.answer(f'Приветствую, {message.from_user.first_name}\n\
Ты оказался в <b>Russian Box Bot</b>.\nПодробную информацию о боте, можешь узнать по кнопкам ниже',
reply_markup=stkb,
parse_mode='HTML')
@dp.callback_query_handler()
async def handle_callback_ru(callback_query: types.CallbackQuery):
if callback_query.data == 'info':
stkb = await inlines.info_kb_ru()
info_mes = await information.info_bot()
await bot.edit_message_text(
chat_id=callback_query.message.chat.id,
message_id=callback_query.message.message_id,
text=info_mes,
parse_mode='HTML')
await bot.edit_message_reply_markup(
chat_id=callback_query.message.chat.id,
message_id=callback_query.message.message_id,
reply_markup=stkb)
...
*inlines.py*
...
async def info_kb_ru():
stkb = InlineKeyboardMarkup(row_width=2)
stkb.add(InlineKeyboardButton(text='Меню', callback_data='menu'),
InlineKeyboardButton(text='Канал', url='https://t.me/goldmasterchannel'),)
return stkb
...