def pco_birthday_lookup(self, message, pco_name): """!birthday | "birthday for" (name): tells you the birthday of a certain user""" if authenticate.check_name(message): if authenticate.get(message, app): self.reply("I might have that birthday I'll look.") attachment = [] for x in birthday.get(pco_name): attachment += x.slack() if not attachment: attachment = msg_attachment.SlackAttachment( text="Sorry I don't have a birthday for " + pco_name, button_text="Search People", button_url="https://people.planningcenteronline.com/" "people?q=" + pco_name.replace(" ", "%20")) print(attachment.slack()) self.say("", message=message, attachments=attachment.slack(), channel=wl_chan_id(self)) else: self.say("Here you go!", message=message, attachments=attachment, channel=wl_chan_id(self)) else: self.say( "Sorry but you don't have access to the People App. " "Please contact your administrator.", channel=wl_chan_id(self)) else: self.say( 'I could not authenticate you. Please make sure your "Full name" ' 'is in your Slack profile and matches your Planning Center Profile.', channel=wl_chan_id(self))
button_text="Search People", button_url="https://people.planningcenteronline.com/" "people?q=" + pco_name.replace(" ", "%20")) print(attachment.slack()) self.say("", message=message, attachments=attachment.slack(), channel=wl_chan_id(self)) else: self.say("Here you go!", message=message, attachments=attachment, channel=wl_chan_id(self)) else: self.say("Sorry but you don't have access to the People App. " "Please contact your administrator.", channel=wl_chan_id(self)) else: self.say('I could not authenticate you. Please make sure your "Full name" ' 'is in your Slack profile and matches your Planning Center Profile.', channel=wl_chan_id(self)) # Test your setup by running this file. # If you add functions in this file please add a test below. if __name__ == '__main__': name = "John" print("Getting phone numbers for ", name) for x in phone_numbers.get(name): print(x.txt()) print("Getting address for ", name) for x in address.get(name): print(x.txt()) print("Getting birthdays for ", name) for x in birthday.get(name): print(x.txt())