Class: Waylon::Skills::Default
- Inherits:
-
Waylon::Skill
- Object
- Waylon::Skill
- Waylon::Skills::Default
- Defined in:
- lib/waylon/skills/default.rb
Overview
The default skill for Waylon, mostly for fallback actions like permissions issues
Instance Attribute Summary
Attributes inherited from Waylon::Skill
#request, #route, #sense, #tokens
Instance Method Summary collapse
-
#denied ⇒ Object
This action is performed when a User tries to run something they aren’t allowed to.
-
#help_postfix ⇒ String
A useful addition to message to tell the User how to get help.
-
#ignore ⇒ Object
This action ignores messages.
-
#unknown ⇒ Object
This is run for unroutable messages (meaning no Skill has claimed them).
Methods inherited from Waylon::Skill
#acknowledgement, #codify, config_namespace, #details, #initialize, #mention, #message, #named_tokens, perform, queue, #react, #reply, #reply_with_blocks, route, #threaded_reply
Methods included from BaseComponent
Constructor Details
This class inherits a constructor from Waylon::Skill
Instance Method Details
#denied ⇒ Object
This action is performed when a User tries to run something they aren’t allowed to
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/waylon/skills/default.rb', line 8 def denied log("Denied '#{tokens.first}' from #{..email}") prefix = . ? "" : "#{mention(.)}," react :lock responses = [ "I can't do that. You'll need an admin adjust your permissions.", "I know what you'd like to do, but you don't have permission for that.", "You don't have permission to do that." ] reply("#{prefix} #{responses.sample} #{help_postfix}") end |
#help_postfix ⇒ String
A useful addition to message to tell the User how to get help
30 31 32 |
# File 'lib/waylon/skills/default.rb', line 30 def help_postfix "Use `help` to see what you're allowed to do." end |
#ignore ⇒ Object
This action ignores messages
24 25 26 |
# File 'lib/waylon/skills/default.rb', line 24 def ignore log("Ignoring black-holed message from #{..email}") end |
#unknown ⇒ Object
This is run for unroutable messages (meaning no Skill has claimed them)
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/waylon/skills/default.rb', line 35 def unknown log("Unroutable message '#{tokens.first}' from #{..email}") prefix = . ? "" : "#{mention(.)}," react :shrug responses = [ "Sorry, I'm not sure what you mean by that.", "I don't have the ability to handle that request, but PRs are welcome!", "I don't know what that means.", "My AI and NLP is only so good... Maybe try rephrasing that request?" ] reply("#{prefix} #{responses.sample} #{help_postfix}") end |