GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - OperationCode/operationcode_bot: Slack bot for responding to Slack events and handling interactive messages. (not currently in use)

This repository was archived by the owner on Sep 4, 2018. It is now read-only.
BranchesTags
Open more actions menu

Latest commit

 

History

191 Commits
191 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
bin
bin
 
 
lib
lib
 
 
test
test
 
 
views
views
 
 
.codeclimate.yml
.codeclimate.yml
 
 
.env
.env
 
 
.gitignore
.gitignore
 
 
.rubocop.yml
.rubocop.yml
 
 
.ruby-gemset
.ruby-gemset
 
 
.ruby-version
.ruby-version
 
 
.travis.yml
.travis.yml
 
 
CODE_OF_CONDUCT.md
CODE_OF_CONDUCT.md
 
 
Dockerfile
Dockerfile
 
 
Gemfile
Gemfile
 
 
Gemfile.lock
Gemfile.lock
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
config.ru
config.ru
 
 
docker-compose.yml
docker-compose.yml
 
 
operationcode_bot.rb
operationcode_bot.rb
 
 
rakefile
rakefile
 
 

Repository files navigation

OperationCodeBot

Build Status Code Climate Test Coverage

OperationCode Bot is a bot built to deal with the Slack Events API. When a subscribed event occurs:

  • Slack sends a POST to this bot
  • The bot processes the event and calls a method with the same name as the event passed in
  • The event named method does whatever tasks are needed

It also handles interactive message button presses. When a button click clicked:

  • Slack send us a POST with the buttom params
  • The bot calls the process method on an instance of the callback_id of the button
  • If @response is set we reply with the response and slack updates the message. This can be just text or a an entire message payload.

Installation

  • Clone this repo

  • Run

    $ bundle

  • Run the tests with

    $ rake

Usage

Adding New Button Responses

Button Presses are called by as a class by way of the callback_id passed in from the slack API. To handle a new action define a new class in lib/button_press. The #process method must be defined. See the existing classes for more help.

Adding new help menu items

To add a new item to the help menu simply create a new class in lib/help_menu. See existing help menu classes for more help. Then you'll just need to add the messages template with $CLASS_NAME_message.txt.erb in views/help_menu/.

Adding A New Event

To create a new event, within the operationcode_bot.rb file, simply define a new private method with the same name as the method you want to handle.

For example, if you wanted to write some code any time someone pins an item (the pin_added event) you would define a new method like so:

private

def pin_added(data, token: nil)
  logger.add "Got pin_added event with data: #{data}"
  empty_response
end

You can now write your business logic inside of this method. If your logic is complex (more than a 5-10 lines) I'd recommend using a ruby object. There is an Event class that can be inherited from to make your life a bit easier. See Event::TeamJoin as a reference.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/OperationCode/operationcode_bot. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

About

Slack bot for responding to Slack events and handling interactive messages. (not currently in use)

Resources

Readme
License

Code of conduct

Code of conduct
Activity
Custom properties

Stars

7 stars

Watchers

2 watching

Forks

35 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.