Делал бота на телеграм:
import telebot
import config
from telebot import types
import random
bot = telebot.TeleBot(config.TOKEN, threaded=False)
@bot.message_handler(commands=['start'])
def welcome(message):
sti=open('stikers/hello_game.webp', 'rb')
bot.send_sticker(message.chat.id, sti)
#keyboard
markup=types.ReplyKeyboardMarkup(resize_keyboard=True)
item1=types.KeyboardButton("random cifra")
item2=types.KeyboardButton("how are you?")
markup.add(item1,item2)
bot.send_message(message.chat.id,"privetstvou tebya, {0.first_name}!\nYa - <b>{1.first_name}</b>, stupid bot ot tovarischa Fletla".format(message.from_user, bot.get_me()),
parse_mode='html',reply_markup=markup)
@bot.message_handler(content_types=['text'])
def lolomg(message):
if message.chat.type=='private':
if message.text=='random cifra':
bot.send_message(message.chat.id, str(random.randint(0,100)))
elif message.text=='how are you?':
markup=types.InlineKeyboardMarkup(row_width=2)
item1=types.InlineKeyboardMarkup("horosho",callback_data='good')
item2=types.InlineKeyboardMarkup("ploho",callback_data='bad')
markup.add(item1,item2)
bot.send_message(message.chat.id, 'namana, sam kak?',perly_markup=markup)
else:
bot.send_message(message.chat.id, 'ya ne znau kak tebe otvetit')
@bot.callback_query_handler(func=lambda call: True)
def callback_inline(call):
try:
if call.message:
if call.data=='good':
bot.send_message(call.message.chat.id, 'vot i horosho')
elif call.data=='bad':
bot.send_message(call.message.chat.id, 'bivaet')
bot.edit_message_text(chat_id=call.message.chat.id, message_id=call.message.message_id, text=" Как дела?",
reply_markup=None)
bot.answer_callback_query(callback_query_id=call.id, show_alert=False,
text="ты нажал")
except Exception as e:
print(repr(e))
# RUN
#bot.polling(none_stop = True)
bot.infinity_polling(True)
выдает ошибку:
File "telegram.py", line 76
print(repr(e))
^
TabError: inconsistent use of tabs and spaces in indentation
никак найти проблему не могу(и в гугле ничего не нашел) (и да это бот по гайду от хауди, но даже его код не запускается)
и в гугле ничего не нашел
- в смысле не нашел? Как минимум первые три ссылки ровно по теме: i.stack.imgur.com/CCZIk.png