Skip to content

Instantly share code, notes, and snippets.

@refoerofekr
Created July 1, 2023 22:42
Show Gist options
  • Save refoerofekr/6150ab6e455cc93e05c5d67ba9c9a800 to your computer and use it in GitHub Desktop.
Save refoerofekr/6150ab6e455cc93e05c5d67ba9c9a800 to your computer and use it in GitHub Desktop.
import telebot
from telebot import types
bot = telebot.TeleBot('5844023785:AAHf_5RwqTlN2twL9W3y-7slgJyzHmEbw-Q')
# стартовое сообщение
@bot.message_handler(commands=['start'])
def startMessage(message):
keyboard = types.InlineKeyboardMarkup()
button = types.InlineKeyboardButton('>', callback_data='mainmenu')
keyboard.add(button)
bot.send_message(chat_id=message.chat.id,
text='Тестовые разделы, еще не продумывал механики.',
reply_markup=keyboard)
# переход к меню
def goToMainMenu(callback):
return callback.data == 'mainmenu'
# меню
@bot.callback_query_handler(func=goToMainMenu)
def mainMenu(edit_message):
user_id = edit_message.message.chat.id
keyboard = types.InlineKeyboardMarkup(row_width=1)
button1 = types.InlineKeyboardButton('Аккаунт', callback_data='account')
button2 = types.InlineKeyboardButton('Торговля', callback_data='trading')
button3 = types.InlineKeyboardButton('Настройки', callback_data='settings')
keyboard.add(button1, button2, button3)
bot.edit_message_text(chat_id=user_id,
message_id=edit_message.message.message_id,
text='Меню выбора говна',
reply_markup=keyboard)
# переход к аккаунту
def goToAccount(callback):
return callback.data == 'account'
# аккаунт
@bot.callback_query_handler(func=goToAccount)
def account(edit_message):
user_id = edit_message.message.chat.id
keyboard = types.InlineKeyboardMarkup(row_width=1)
button1 = types.InlineKeyboardButton('Майнинг', callback_data='mining')
button2 = types.InlineKeyboardButton('Детали', callback_data='details')
button3 = types.InlineKeyboardButton('<', callback_data='mainmenu')
keyboard.add(button1, button2, button3)
bot.edit_message_text(chat_id=user_id,
message_id=edit_message.message.message_id,
text='Второе меню выбора говна',
reply_markup=keyboard)
bot.polling(non_stop=True, interval = 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment