示例#1
0
def main():

    load_reacters()

    bot = TelegramBot(TOKEN)
    bot.polling(none_stop=None, interval=1)
示例#2
0
        switch_light(message, HueLight.GO, LightCommand.TOGGLE)
    else:
        set_light_color(message, HueLight.GO, command_param)


@bot.message_handler(commands=['salon'])
def handle_living_room_light(message):
    switch_light(message, HueLight.LIVING_ROOM_TOP, LightCommand.TOGGLE)


@bot.message_handler(commands=['kuchnia'])
def handle_living_room_light(message):
    switch_light(message, HueLight.KITCHEN_TOP, LightCommand.TOGGLE)


@bot.message_handler(commands=['sleepy'])
def handle_sleepy_time(message):
    switch_light(message, HueLight.BEDROOM_TOP, LightCommand.OFF)
    switch_light(message, HueLight.BEDROOM_BED, LightCommand.ON)
    set_light_brightness(message, HueLight.BEDROOM_BED, 20)


@bot.message_handler(commands=['goodbye'])
def handle_living_room_light(message):
    for light in HueLight:
        switch_light(message, light, LightCommand.OFF)
    bot.send_message(message.chat.id, 'Dobrej nocy! \U0001F319')


bot.polling()