Beispiel #1
0
def talk_about_planet(bot, update):
    user_text = update.message.text

    planet = user_text.capitalize()
    print('Вопрос о планете ' + planet)

    if planet == 'Sun':
        place = ephem.constellation(ephem.Sun(datetime.datetime.now()))
    elif planet == 'Moon':
        place = ephem.constellation(ephem.Moon(datetime.datetime.now()))
    elif planet == 'Earth':
        place = ephem.constellation(ephem.Earth(datetime.datetime.now()))
    elif planet == 'Mercury':
        place = ephem.constellation(ephem.Mercury(datetime.datetime.now()))
    elif planet == 'Mars':
        place = ephem.constellation(ephem.Mars(datetime.datetime.now()))
    elif planet == 'Venus':
        place = ephem.constellation(ephem.Venus(datetime.datetime.now()))
    elif planet == 'Jupiter':
        place = ephem.constellation(ephem.Jupiter(datetime.datetime.now()))
    elif planet == 'Uranus':
        place = ephem.constellation(ephem.Uranus(datetime.datetime.now()))
    elif planet == 'Neptune':
        place = ephem.constellation(ephem.Neptune(datetime.datetime.now()))
    else:
        place = 'NO'

    print(place)
    if place == 'NO':
        answer_text = 'Не могу дать ответ'
    else:
        answer_text = planet + ' находится в ' + place[1]

    print(answer_text)
    update.message.reply_text(answer_text)
def get_planet(
        update, context
):  #функция показывает в каком созвездии планета с командой /planet
    date_user = '******'  #input('Введите дату в формате год/месяц/день: ')

    if context.args[0] == 'mars':
        planetname = ephem.Mars(date_user)
    elif context.args[0] == 'venus':
        planetname = ephem.Venus(date_user)
    elif context.args[0] == 'jupiter':
        planetname = ephem.Jupiter(date_user)
    elif context.args[0] == 'earth':
        planetname = ephem.Earth(date_user)
    elif context.args[0] == 'moon':
        planetname = ephem.Moon(date_user)
    elif context.args[0] == 'sun':
        planetname = ephem.Sun(date_user)
    elif context.args[0] == 'uranus':
        planetname = ephem.Uranus(date_user)
    elif context.args[0] == 'pluto':
        planetname = ephem.Pluto(date_user)
    else:
        update.message.reply_text('ошибочка вышла')
        return

    constel_planet = ephem.constellation(planetname)
    update.message.reply_text(
        f'{date_user} Планета {context.args[0].upper()} в созвездии {constel_planet[-1]}'
    )
Beispiel #3
0
def planet1(bot, update):
	text = 'Введите название планеты '
	print(text)
	update.message.reply_text(text)
	#bot.send_message(text)
	text = message.text
	planet_choose = update.message.text
	print ('Бля,...', planet_choose)
	#planet_choose = update.message.text
	dt1 = dt.today()
	#planet_choose = input('Выберите планету: ')
	if planet_choose.lower() == 'mercury':
		planet = ep.constellation(ep.Mercury(dt1))
	elif planet_choose.lower() =='venus':
		planet =ep.constellation(ep.Venus(dt1))
	elif planet_choose.lower() =='earth':
		planet = ep.constellation(ep.Earth(dt1))
	elif planet_choose.lower() =='mars':
		planet =ep.constellation(ep.Mars(dt1))
			#print(planet)
	elif planet_choose.lower() =='jupiter':
		planet =ep.constellation(ep.Jupiter(dt1))
	elif planet_choose.lower() =='saturn':
		planet =ep.constellation(ep.Saturn(dt1))
	elif planet_choose.lower() =='uranus':
		planet = ep.constellation(ep.Uranus(dt1))
	elif planet_choose.lower() =='neptune':
		planet = ep.constellation(ep.Neptune(dt1))
	elif planet_choose.lower() =='pluto':
		planet = ep.constellation(ep.Pluto(dt1))
	else:
		print (planet_choose)
		planet = 'Нет таких планет'
	print(planet)
	update.message.reply_text(planet)
Beispiel #4
0
def planets_chat(bot, update):
    name_planet = update.message.text
    logging.info(name_planet)
    if name_planet == 'Mars':
        sky = ephem.Mars()
    elif name_planet == 'Mercury':
        sky = ephem.Mercury()
    elif name_planet == 'Venus':
        sky = ephem.Venus()
    elif name_planet == 'Earth':
        sky = ephem.Earth()
    elif name_planet == 'Jupiter':
        sky = ephem.Jupiter()
    elif name_planet == 'Saturn':
        sky = ephem.Saturn()
    elif name_planet == 'Uranus':
        sky = ephem.Uranus()
    elif name_planet == 'Neptune':
        sky = ephem.Neptune()
    elif name_planet == 'Pluto':
        sky = ephem.Pluto()
    else:
        update.message.reply_text('Wrong name planet')
    sky.compute(datetime.date.today())
    update.message.reply_text(ephem.constellation(sky))
Beispiel #5
0
def get_constellation(bot, update, args):
    #print(args[0])
    date = datetime.datetime.now().strftime('%Y/%m/%d')
    #print(date)
    #planet = ephem.args[0](date.strftime('%Y/%m/%d'))
    #print(ephem.constellation(planet))

    if args[0] == 'Mercury':
        planet = ephem.Mercury(date)
        result = ephem.constellation(planet)
        update.message.reply_text('{} is in constellation of {}'.format(
            args[0], result[1]))

    if args[0] == 'Venus':
        planet = ephem.Venus(date)
        result = ephem.constellation(planet)
        update.message.reply_text('{} is in constellation of {}'.format(
            args[0], result[1]))

    if args[0] == 'Earth':
        planet = ephem.Earth(date)
        result = ephem.constellation(planet)
        update.message.reply_text('{} is in constellation of {}'.format(
            args[0], result[1]))

    if args[0] == 'Mars':
        planet = ephem.Mars(date)
        result = ephem.constellation(planet)
        update.message.reply_text('{} is in constellation of {}'.format(
            args[0], result[1]))

    if args[0] == 'Jupiter':
        planet = ephem.Jupiter(date)
        result = ephem.constellation(planet)
        update.message.reply_text('{} is in constellation of {}'.format(
            args[0], result[1]))

    if args[0] == 'Saturn':
        planet = ephem.Saturn(date)
        result = ephem.constellation(planet)
        update.message.reply_text('{} is in constellation of {}'.format(
            args[0], result[1]))

    if args[0] == 'Uranus':
        planet = ephem.Uranus(date)
        result = ephem.constellation(planet)
        update.message.reply_text('{} is in constellation of {}'.format(
            args[0], result[1]))

    if args[0] == 'Neptune':
        planet = ephem.Neptune(date)
        result = ephem.constellation(planet)
        update.message.reply_text('{} is in constellation of {}'.format(
            args[0], result[1]))
Beispiel #6
0
def planet_ep(bot, update, args):
    print('Вызван /planet')
    if args[0] == 'Venus':
        text = ephem.Venus(date_str)
        print(text)
        text1 = ephem.constellation(text)
        print(text1)
        update.message.reply_text(text1)
    elif args[0] == 'Mercury':
        text = ephem.Venus(date_str)
        print(text)
        text1 = ephem.constellation(text)
        print(text1)
        update.message.reply_text(text1)
    elif args[0] == 'Earth':
        text = ephem.Earth(date_str)
        print(text)
        text1 = ephem.constellation(text)
        print(text1)
        update.message.reply_text(text1)
    elif args[0] == 'Mars':
        text = ephem.Mars(date_str)
        print(text)
        text1 = ephem.constellation(text)
        print(text1)
        update.message.reply_text(text1)
    elif args[0] == 'Jupiter':
        text = ephem.Jupiter(date_str)
        print(text)
        text1 = ephem.constellation(text)
        print(text1)
        update.message.reply_text(text1)
    elif args[0] == 'Saturn':
        text = ephem.Saturn(date_str)
        print(text)
        text1 = ephem.constellation(text)
        print(text1)
        update.message.reply_text(text1)
    elif args[0] == 'Uranus':
        text = ephem.Uranus(date_str)
        print(text)
        text1 = ephem.constellation(text)
        print(text1)
        update.message.reply_text(text1)
    elif args[0] == 'Neptune':
        text = ephem.Neptune(date_str)
        print(text)
        text1 = ephem.constellation(text)
        print(text1)
        update.message.reply_text(text1)
    else:
        text = 'Такой планеты нет'
        update.message.reply_text(text)
def planet_coor(update, context):

    if update.message.text == "/Mercury":
        date = datetime.date.today()
        coordinates_planet = ephem.Mars(f'{date}')
        constellation = ephem.constellation(coordinates_planet)
        update.message.reply_text(constellation)
        update.message.reply_text(coordinates_planet)
    elif update.message.text == "/Venus":
        date = datetime.date.today()
        coordinates_planet = ephem.Venus(f'{date}')
        constellation = ephem.constellation(coordinates_planet)
        update.message.reply_text(constellation)
        update.message.reply_text(coordinates_planet)
    elif update.message.text == "/Earth":
        date = datetime.date.today()
        coordinates_planet = ephem.Earth(f'{date}')
        constellation = ephem.constellation(coordinates_planet)
        update.message.reply_text(constellation)
        update.message.reply_text(coordinates_planet)
    elif update.message.text == "/Mars":
        date = datetime.date.today()
        coordinates_planet = ephem.Mars(f'{date}')
        constellation = ephem.constellation(coordinates_planet)
        update.message.reply_text(constellation)
        update.message.reply_text(coordinates_planet)
    elif update.message.text == "/Jupiter":
        date = datetime.date.today()
        coordinates_planet = ephem.Jupiter(f'{date}')
        constellation = ephem.constellation(coordinates_planet)
        update.message.reply_text(constellation)
        update.message.reply_text(coordinates_planet)
    elif update.message.text == "/Saturn":
        date = datetime.date.today()
        coordinates_planet = ephem.Saturn(f'{date}')
        constellation = ephem.constellation(coordinates_planet)
        update.message.reply_text(constellation)
        update.message.reply_text(coordinates_planet)
    elif update.message.text == "/Uranus":
        date = datetime.date.today()
        coordinates_planet = ephem.Uranus(f'{date}')
        constellation = ephem.constellation(coordinates_planet)
        update.message.reply_text(constellation)
        update.message.reply_text(coordinates_planet)
    elif update.message.text == "/Neptune":
        date = datetime.date.today()
        coordinates_planet = ephem.Neptune(f'{date}')
        constellation = ephem.constellation(coordinates_planet)
        update.message.reply_text(constellation)
        update.message.reply_text(coordinates_planet)
    else:
        update.message.reply_text("Я не знаю такой планеты")
Beispiel #8
0
def planet_definition(bot, update):
    today_str = datetime.datetime.today()
    text_split = update.message.text.split()
    text = text_split[1].capitalize()
    if text == 'Mercury':
        const = ephem.constellation(ephem.Mercury(today_str))
        print(const)
    elif text == 'Venus':
        const = ephem.constellation(ephem.Venus(today_str))
        print(const)
    elif text == 'Earth':
        const = ephem.constellation(ephem.Earth(today_str))
        print(const)
def planet_user(
        update,
        context):  #функция показывает в каком созвездии планета без команды
    date_planet = '2121/03/05'

    if update.message.text == 'mars':
        planet = ephem.Mars(date_planet)
    elif update.message.text == 'venus':
        planet = ephem.Venus(date_planet)
    elif update.message.text == 'jupiter':
        planet = ephem.Jupiter(date_planet)
    elif update.message.text == 'earth':
        planet = ephem.Earth(date_planet)
    else:
        update.message.reply_text('что-то пошло не так')
        return

    const_planet = ephem.constellation(planet)
    update.message.reply_text(
        f'{date_planet} Планета {update.message.text.upper()} в созвездии {const_planet[-1]}'
    )
Beispiel #10
0
def planet_constellation(planet):
    if planet == 'Mercury':
        return ephem.constellation(ephem.Mercury(datetime.today()))
    elif planet == 'Venus':
        return ephem.constellation(ephem.Venus(datetime.today()))
    elif planet == 'Earth':
        return ephem.constellation(ephem.Earth(datetime.today()))
    elif planet == 'Mars':
        return ephem.constellation(ephem.Mars(datetime.today()))
    elif planet == 'Jupiter':
        return ephem.constellation(ephem.Jupiter(datetime.today()))
    elif planet == 'Saturn':
        return ephem.constellation(ephem.Saturn(datetime.today()))
    elif planet == 'Uranus':
        return ephem.constellation(ephem.Uranus(datetime.today()))
    elif planet == 'Neptune':
        return ephem.constellation(ephem.Neptune(datetime.today()))
    elif planet == 'Pluto':
        return ephem.constellation(ephem.Pluto(datetime.today()))
    else:
        return 'Incorrect planet name, try again please'
Beispiel #11
0
def get_constellation(planet_name, date):
    print('get_constellation start: ', planet_name)
    if planet_name == 'Mercury':
        planet = ephem.Mercury(date)
    elif planet_name == 'Venus':
        planet = ephem.Venus(date)
    elif planet_name == 'Earth':
        planet = ephem.Earth(date)
    elif planet_name == 'Mars':
        planet = ephem.Mars(date)
    elif planet_name == 'Jupiter':
        planet = ephem.Jupiter(date)
    elif planet_name == 'Saturn':
        planet = ephem.Saturn(date)
    elif planet_name == 'Uranus':
        planet = ephem.Uranus(date)
    elif planet_name == 'Neptune':
        planet = ephem.Neptune(date)
    print('get_constellation end if:', planet)
    cons_name = ephem.constellation(planet)
    print('the planet {planet} in the constellation {cons}'.format(
        planet=planet_name, cons=cons_name))
    return (cons_name)
Beispiel #12
0
def planet(update, context):
    planet = update.message.text.split()
    if "mercury" in planet:
      mercury = ephem.Mercury(datetime.date.today())
      planet = ephem.constellation(mercury)
    else:
      if "venus"in planet:
        venus = ephem.Venus(datetime.date.today())
        planet = ephem.constellation(venus)
      else:
          if 'earth' in planet:
            earth = ephem.Earth(datetime.date.today())
            planet = ephem.constellation(earth)
          else:
              if 'mars'in planet:
                mars = ephem.Mars(datetime.date.today())
                planet = ephem.constellation(mars)
              else:
                  if 'jupiter' in planet:
                    jupiter = ephem.Jupiter(datetime.date.today())
                    planet = ephem.constellation(jupiter)
                  else:
                      if 'saturn' in planet:
                        saturn = ephem.Saturn(datetime.date.today())
                        planet = ephem.constellation(saturn)
                      else:
                          if 'uranus' in planet:
                            uranus = ephem.Uranus(datetime.date.today())
                            planet = ephem.constellation(uranus)
                          else:
                              if 'neptune'in planet:
                                neptune = ephem.Neptune(datetime.date.today())
                                planet = ephem.constellation(neptune)
                              else:
                                  planet = 'unknown planet'
     
    update.message.reply_text(planet)
Beispiel #13
0
def planet(bot, update):
    selected_planet = update.message.text[1:]
    current_date = datetime.date.today()

    if selected_planet == 'Mercury':
        pln = ephem.Mercury(current_date)
    elif selected_planet == 'Venus':
        pln = ephem.Venus(current_date)
    elif selected_planet == 'Earth':
        pln = ephem.Earth(current_date)
    elif selected_planet == 'Mars':
        pln = ephem.Mars(current_date)
    elif selected_planet == 'Jupiter':
        pln = ephem.Jupiter(current_date)
    elif selected_planet == 'Saturn':
        pln = ephem.Saturn(current_date)
    elif selected_planet == 'Uranus':
        pln = ephem.Uranus(current_date)
    elif selected_planet == 'Neptune':
        pln = ephem.Neptune(current_date)

    pln_position = ephem.constellation(pln)
    my_text = "{} position {}".format(selected_planet, pln_position)
    update.message.reply_text(my_text)
Beispiel #14
0
def planet_constellation(bot, update):

    p_planet = update.message.text
    if p_planet.lower() == 'mars':
        ret = ephem.constellation(ephem.Mars(datetime.datetime.now()))
    elif p_planet.lower() == 'venus':
        ret = ephem.constellation(ephem.Venus(datetime.datetime.now()))
    elif p_planet.lower() == 'jupiter':
        ret = ephem.constellation(ephem.Jupiter(datetime.datetime.now()))
    elif p_planet.lower() == 'uranus':
        ret = ephem.constellation(ephem.Uranus(datetime.datetime.now()))
    elif p_planet.lower() == 'neptune':
        ret = ephem.constellation(ephem.Neptune(datetime.datetime.now()))
    elif p_planet.lower() == 'sun':
        ret = ephem.constellation(ephem.Sun(datetime.datetime.now()))
    elif p_planet.lower() == 'moon':
        ret = ephem.constellation(ephem.Moon(datetime.datetime.now()))
    elif p_planet.lower() == 'earth':
        ret = ephem.constellation(ephem.Earth(datetime.datetime.now()))
    elif p_planet.lower() == 'mercury':
        ret = ephem.constellation(ephem.Mercury(datetime.datetime.now()))

    update.message.reply_text('Планета ' + p_planet +
                              ' находится в созвездии ' + ret[1])
Beispiel #15
0
import ephem as ep
from datetime import datetime as dt

dt1 = dt.today()
print(dt1)
planet_choose = input('Выберите планету: ')
try:
    if planet_choose.lower() == 'mercury':
        print(ep.constellation(ep.Mercury(dt1)))
    elif planet_choose.lower() == 'venus':
        print(ep.constellation(ep.Venus(dt1)))
    elif planet_choose.lower() == 'earth':
        print(ep.constellation(ep.Earth(dt1)))
    elif planet_choose.lower() == 'mars':
        print(ep.constellation(ep.Mars(dt1)))
    elif planet_choose.lower() == 'jupiter':
        print(ep.constellation(ep.Jupiter(dt1)))
    elif planet_choose.lower() == 'saturn':
        print(ep.constellation(ep.Saturn(dt1)))
    elif planet_choose.lower() == 'uranus':
        print(ep.constellation(ep.Uranus(dt1)))
    elif planet_choose.lower() == 'neptune':
        print(ep.constellation(ep.Neptune(dt1)))
    elif planet_choose.lower() == 'pluto':
        print(ep.constellation(ep.Pluto(dt1)))
    else:
        print('Нет таких планет')
except:
    print('Нет таких планет')
Beispiel #16
0
import ephem
import datetime
date = str(datetime.datetime.now().date()).replace("-", "/")

planet = input('Введите планету ')
if planet == 'Mars':
    planet_place = ephem.Mars(date)
elif planet == 'Saturn':
    planet_place = ephem.Saturn(date)
elif planet == 'Mercury':
    planet_place = ephem.Mercury(date)
elif planet == 'Venus':
    planet_place = ephem.Venus(date)
elif planet == 'Earth':
    planet_place = ephem.Earth(date)
elif planet == 'Jupiter':
    planet_place = ephem.Jupiter(date)
elif planet == 'Uranus':
    planet_place = ephem.Uranus(date)
elif planet == 'Neptune':
    planet_place = ephem.Neptune(date)
elif planet == 'Pluto':
    planet_place = ephem.Pluto(date)
else:
    print('Нет такой планеты в солнечной системе')

print(ephem.constellation(planet_place))
def name_planet(update, context):
    user_text = update.message.text
    planet = user_text.split()
    if len(planet) < 3:
        planet = planet[-1]
        date = datetime.date.today()
        if planet == "Mercury":
            date = datetime.date.today()
            coordinates_planet = ephem.Mars(f'{date}')
            constellation = ephem.constellation(coordinates_planet)
            update.message.reply_text(constellation)
            update.message.reply_text(coordinates_planet)
        elif planet == "Venus":
            date = datetime.date.today()
            coordinates_planet = ephem.Venus(f'{date}')
            constellation = ephem.constellation(coordinates_planet)
            update.message.reply_text(constellation)
            update.message.reply_text(coordinates_planet)
        elif planet == "Earth":
            date = datetime.date.today()
            coordinates_planet = ephem.Earth(f'{date}')
            constellation = ephem.constellation(coordinates_planet)
            update.message.reply_text(constellation)
            update.message.reply_text(coordinates_planet)
        elif planet == "Mars":
            date = datetime.date.today()
            coordinates_planet = ephem.Mars(f'{date}')
            constellation = ephem.constellation(coordinates_planet)
            update.message.reply_text(constellation)
            update.message.reply_text(coordinates_planet)
        elif planet == "Jupiter":
            date = datetime.date.today()
            coordinates_planet = ephem.Jupiter(f'{date}')
            constellation = ephem.constellation(coordinates_planet)
            update.message.reply_text(constellation)
            update.message.reply_text(coordinates_planet)
        elif planet == "Saturn":
            date = datetime.date.today()
            coordinates_planet = ephem.Saturn(f'{date}')
            constellation = ephem.constellation(coordinates_planet)
            update.message.reply_text(constellation)
            update.message.reply_text(coordinates_planet)
        elif planet == "Uranus":
            date = datetime.date.today()
            coordinates_planet = ephem.Uranus(f'{date}')
            constellation = ephem.constellation(coordinates_planet)
            update.message.reply_text(constellation)
            update.message.reply_text(coordinates_planet)
        elif planet == "Neptune":
            date = datetime.date.today()
            coordinates_planet = ephem.Neptune(f'{date}')
            constellation = ephem.constellation(coordinates_planet)
            update.message.reply_text(constellation)
            update.message.reply_text(coordinates_planet)
        else:
            update.message.reply_text("Я не знаю такой планеты")

    else:
        print("Необходимо ввести в формате 'planet \"название планеты\"'")
        update.message.reply_text(
            "Необходимо ввести в формате 'planet \"название планеты\"'")