def broadcast_message(message):
    t = bot_util.read_one_string_file(novgorod_weather_bot.TOKEN_FILENAME)
    botan_t = bot_util.read_one_string_file(novgorod_weather_bot.BOTAN_TOKEN_FILENAME)
    bot = novgorod_weather_bot.NovgorodWeatherBot(t, name="NovgorodWeatherBot", botan_token=botan_t)
    lines = open(bot.chats_file, 'r').readlines()
    for l in lines:
        l = int(l)
        bot.send_response(l, message)
Пример #2
0
 def _read_previous_update_date(self):
     u = bot_util.read_one_string_file(self._PREVIOUS_UPDATE_DATE_FILENAME)
     if u == "" or None == u:
         return 0
     return int(u)
        wind_direction = avewind["dir"]
        emoji = u""
        print icon
        if icon == "chancerain":
            emoji = DROPS_EMOJI
        if icon == "cloudy":
            emoji = OVERCAST_EMOJI
        return (
            low
            + u"°C ... "
            + high
            + u"°C, "
            + conditions
            + u" "
            + emoji
            + u", Wind: "
            + wind_direction
            + u" "
            + wind_speed
            + u" kp/h\n"
        )


if __name__ == "__main__":
    f = YandexForecaster.get_forecast()
    t = bot_util.read_one_string_file("../data/weather_com_token")
    f = WeatherComForecaster(t)
    f = f.get_forecast()
    if f:
        print "OK"
                else:
                    return u"Проблемы при получении прогноза погоды"
        if self._check_message_for_command(text, self.COMMAND_GET_BUTTHUR):
            return "https://pp.vk.me/c629309/v629309903/209b8/a22Q1yCTn4s.jpg"
        return False

    def _get_start_message(self):
        return """
        Погода в великом Новгороде
        Команды:
        /start, /help
        /getweather — Погода
        /getforecast — Прогноз

        Погода — [Новгород.ру](http://novgorod.ru/weather)
        Прогноз — Яндекс.Погода, Weather.com
        [Логотип бота](vk.com/mzzaxixart)
        [Автор бота](ilya.fut33v.ru/contacts), Telegram: @fut33v

        [Оценить в Store Bot](https://telegram.me/storebot?start=novgorodweatherbot)
        [Github](https://github.com/fut33v/NovgorodWeatherBot)
        """


if __name__ == "__main__":
    t = bot_util.read_one_string_file(TOKEN_FILENAME)
    botan_t = bot_util.read_one_string_file(BOTAN_TOKEN_FILENAME)
    weather_com_t = bot_util.read_one_string_file(WEATHER_COM_TOKEN_FILENAME)
    bot = NovgorodWeatherBot(t, name="NovgorodWeatherBot", botan_token=botan_t, weather_com_token=weather_com_t)
    bot.start_poll()