G
G
ghazar7an2020-04-25 17:45:32
Python
ghazar7an, 2020-04-25 17:45:32

Process finished with exit code 0 || How to decide?

Process finished with exit code 0
What's wrong here?

import config
import telebot
import requests
from bs4 import BeautifulSoup as BS
r = requests.get('https://sinoptik.ua/погода-ереван')
html = BS(r.content, 'html.parser')
bot = telebot.TeleBot(config.token)

for el in html.select('#content'):
    t_min = el.select('.temperature .min')[0].text
    t_max = el.select('.temperature .max')[0].text
    text = el.select('.wDescription .description')[0].text

    keyboard1 = telebot.types.ReplyKeyboardMarkup()
    keyboard1.row('Погода', 'Եղանակ', 'Help', 'Новости')
@bot.message_handler(commands=['start'])
def start_message(message):
    privetstvie = f" Привет {message.from_user.first_name} \nНиже представлены команды бота: "
    bot.send_message(message.chat.id, privetstvie, resize_keyboard=True,  reply_markup=keyboard1)


@bot.message_handler(commands=['Text' , 'Putin' , 'Путин'])
def send_message(message):
    bot.send_sticker(message.chat.id, 'CAADAgADZgkAAnlc4gmfCor5YbYYRAI')

@bot.message_handler(content_types=['text'])
def send_text(message):
        if message.text == 'Погода':
            bot.send_message(message.chat.id, "Привет, погода на сегодня в Ереване:\n" +
                     t_min + ', ' + t_max + '\n' + text)
        elif message.text == 'Եղանակ':
            bot.send_message(message.chat.id, "Привет, погода на сегодня в Ереване:\n" +
                     t_min + ', ' + t_max + '\n' + text)


@bot.message_handler(content_types=['text'])
def send_text(message):
        if message.text == 'Помощь':
            bot.send_message(message.chat.id, "Список команд: \n <b>/start<b/>")
        elif message.text == 'Help':
            bot.send_message(message.chat.id, "Список команд: \n <b>/start<b/>")


if __name__ == '__main__':
    bot.polling(none_stop=True)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Karbivnichy, 2020-04-25
@ghazar7an

You have an error in your code:
from the line:

bot.send_message(message.chat.id, privetstvie, resize_keyboard=True,  reply_markup=keyboard1)

need to remove 'resize_keyboard=True'
and add to:
keyboard1 = telebot.types.ReplyKeyboardMarkup(resize_keyboard=True)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question