def get(self): if not database.get_setting(Setting.ENABLED): return response = Response() if prob(0.2): response.add_msg_or_voice(random_of(good_night_phrases)) elif prob(0.05): response.add_msg(get_9gag_post_url()) if prob(0.5): response.add_msg_or_voice(laughter) main.send_to_group(response)
def get(self): if not database.get_setting(Setting.ENABLED): return database.check_nicknames() response = Response() bdays = has_birthday(database.get_user_list()) if bdays: for bday_user in bdays: first_name = bday_user.first_name if bday_user.nickname: first_name = bday_user.nickname response.add_msg(first_name + u' ' + random_of(birthday_wishes)) if prob(0.2): response.add_msg_or_voice(random_of(greetings_morning)) if prob(0.08): w = apis.openweathermap.Weather() if prob(0.5): response.add_msg(random_of(address) + u'! ' + describe_wheather(w)) temperature = w.getTemperature() desc = w.getDescription() if temperature < 5 and prob(0.2): response.add_msg(u'Zieht euch ne Jacke an, es werden ' + str(temperature) + u' Grad') elif temperature > 20 and prob(0.2): response.add_msg(u'Auf zum Strabi! Es werden' + str(temperature) + u'Grad') elif desc == 'Snow' and prob(0.2): response.add_msg(u'Fahrt vorsichtig ' + random_of(address) + u'. Es gibt heute schnee.') elif 7 < temperature < 20 and prob(0.01): response.add_msg_or_voice(u'Wetter wird heut Mittel..') if prob(0.1): user = database.get_random_user() if user.nickname: return else: user.set_nickname(random_line(Textfile.NAMES).rstrip('\n')) response.add_msg(user.first_name + u' ' + random_of(new_nickname) + u' ' + user.nickname) main.send_to_group(response)