Снова здравствуйте. Я решил переписать на inline keyboard. Но случалось проблема. Кнопки до "if call.data == 'phoenix' "работают, после него - нет. Код приложу ниже.
Код:
import telebot
from telebot import types
from config import TOKEN
bot = telebot.TeleBot(TOKEN)
@bot.message_handler(commands=['start'])
def start(message):
start = types.ReplyKeyboardMarkup(resize_keyboard=True)
item1 = types.KeyboardButton('Arizona GAMES')
start.add(item1)
bot.send_message(message.chat.id, 'Привет, ты попал в личные сообщение с ботом ARIZONA GAMES, для следующий действий используй кнопкни ниже.', reply_markup = start)
@bot.message_handler(content_types=['text'])
def bot_message(message):
if message.chat.type == 'private':
if message.text == 'Arizona GAMES':
arzg = types.InlineKeyboardMarkup()
arz = types.InlineKeyboardButton('Arizona RP', callback_data='arg')
rod = types.InlineKeyboardButton('Rodina RP', callback_data='rod')
jdv = types.InlineKeyboardButton('Жизнь в Деревне', callback_data='jdv')
arzg.add(arz, rod, jdv)
bot.send_message(message.chat.id, 'Вы выбрали: Arizona Games', reply_markup=arzg)
@bot.callback_query_handler(func=lambda call:True)
def arzg(call):
if call.message:
if call.data == 'arg':
nazv = types.InlineKeyboardMarkup()
phoenix = types.InlineKeyboardButton('Phoenix', callback_data='phoenix')
tucson = types.InlineKeyboardButton('Tucson', callback_data='tucson')
scottdale = types.InlineKeyboardButton('Scottdale', callback_data='scottdale')
chandler = types.InlineKeyboardButton('Chandler', callback_data='chandler')
brainburg = types.InlineKeyboardButton('Brainburg', callback_data='brainburg')
saintrose = types.InlineKeyboardButton('Saint Rose', callback_data='saintrose')
mesa = types.InlineKeyboardButton('Mesa',callback_data='mesa')
redrock = types.InlineKeyboardButton('Red Rock',callback_data='redrock')
yuma = types.InlineKeyboardButton('Yuma',callback_data='yuma')
surprise = types.InlineKeyboardButton('Surprise', callback_data='surprise')
prescott = types.InlineKeyboardButton('Prescott',callback_data='prescott')
glendale = types.InlineKeyboardButton('Glendale',callback_data='glendale')
kingman = types.InlineKeyboardButton('Kingman',callback_data='kingman')
winslow = types.InlineKeyboardButton('Winslow', callback_data='winslow')
payson = types.InlineKeyboardButton('Payson', callback_data='payson')
gilbert = types.InlineKeyboardButton('Gilbert', callback_data='gilbert')
showlow = types.InlineKeyboardButton('Show-Low', callback_data='showlow')
nazv.add(phoenix,tucson,scottdale,chandler,brainburg,saintrose,mesa,redrock,yuma,surprise,prescott,glendale,kingman,winslow,payson,gilbert,showlow)
bot.send_message(call.message.chat.id, 'Выберите сервер по которому хотите информацию.', reply_markup=nazv)
@bot.callback_query_handler(func=lambda call:True)
def serv(call):
if call.message:
if call.data == 'phoenix':
phoenix1 = types.InlineKeyboardMarkup()
vk = types.InlineKeyboardButton('Вконтакте', url='https://vk.com/arizona1phoenix')
discord = types.InlineKeyboardButton('Дискорд', url='https://discord.gg/rpfXy3t')
forum = types.InlineKeyboardButton('Раздел форума', url='https://forum.arizona-rp.com/forums/338/')
phoenix1.add(vk,discord,forum)
bot.send_message(call.message.chat.id,'Выбрано: Phoenix', reply_markup=phoenix1)
bot.polling(none_stop=True)