diff --git a/plugins/pco/announcements.py b/plugins/pco/announcements.py index d2f54dfd..3bd8f67d 100644 --- a/plugins/pco/announcements.py +++ b/plugins/pco/announcements.py @@ -1,6 +1,13 @@ from will.plugin import WillPlugin from will.decorators import respond_to, periodic, hear, randomly, route, rendered_template, require_settings -from plugins.pco import birthday, address, phone_numbers, checkins, msg_attachment, authenticate +from plugins.pco import birthday, address, phone_numbers, checkins, msg_attachment, authenticate, pcoservices + + +class SchedulePlugin(WillPlugin): + # @hear("announce") + def announce_banana(self, message, channel="general"): + self.say("announcing in: %s" % channel, channel=channel) + AnnouncementPlugin.banana(self, message, channel=channel) class AnnouncementPlugin(WillPlugin): @@ -8,3 +15,12 @@ class AnnouncementPlugin(WillPlugin): # @periodic(second=0) # every minute at 0 seconds def announcetime(self): self.say("Announcement!", channel="general") + + # @hear("banana") + def banana(self, message, channel=None): + self.say("Bananaaaaa! %s" % channel, channel=channel) + + # @hear("this channel") + def this_channel(self, message, channel=None): + self.say("This channel's name is %s" % self.message.data.channel.name, channel=channel) + self.say("This channel's id is %s" % self.message.data.channel.id, channel=channel) diff --git a/plugins/pco/pcoservices.py b/plugins/pco/pcoservices.py index aa4ba5f2..6fcbf5a1 100644 --- a/plugins/pco/pcoservices.py +++ b/plugins/pco/pcoservices.py @@ -49,7 +49,6 @@ def pco_song_lookup(self, message, pco_song): self.reply("Sorry I don't find " + song + "in services.") self.reply("", message=message, attachments=attachment) - # Test your setup by running this file. # If you add functions in this file please add a test below. diff --git a/will/backends/io_adapters/slack.py b/will/backends/io_adapters/slack.py index 3dc40060..ac3aff9c 100644 --- a/will/backends/io_adapters/slack.py +++ b/will/backends/io_adapters/slack.py @@ -205,7 +205,8 @@ def handle_outgoing_event(self, event): event.data.is_direct and event.data.will_said_it is False ): - event.content = random.choice(UNSURE_REPLIES) + self.people # get the object that contains bot's handle + event.content = random.choice(UNSURE_REPLIES) + " Try `@%s help`" % self.me.handle self.send_message(event) def handle_request(self, r, data): diff --git a/will/plugins/help/help.py b/will/plugins/help/help.py index 7333ebcf..5f716608 100644 --- a/will/plugins/help/help.py +++ b/will/plugins/help/help.py @@ -2,6 +2,15 @@ from will.decorators import respond_to, periodic, hear, randomly, route, rendered_template, require_settings +class PublicHelpPlugin(WillPlugin): + + # If a user posts the single word `help` in chat, we'll help them. + @hear("help") + def public_help(self, message): + HelpPlugin.help(self, message, plugin=None) + self.say("And remember %s, I'll always respond when you message me directly!" % message.sender.first_name, color="yellow") + + class HelpPlugin(WillPlugin): @respond_to("^help(?: (?P.*))?$") diff --git a/will/utils.py b/will/utils.py index 3c4ff668..5cde9307 100644 --- a/will/utils.py +++ b/will/utils.py @@ -4,9 +4,9 @@ UNSURE_REPLIES = [ - "Hmm. I'm not sure what to say.)", - "I didn't understand that. Message me directly with the word *help* to see what I can do.", - "I heard you, but I'm not sure what to do. Direct message me *help* to see my commands.", + "Hmm. I'm not sure what to say.", + "I didn't understand that.", + "I heard you, but I'm not sure what to do.", "I'm not sure what that means.", ]