Skip to content

hattan/ccbot

Repository files navigation

ccbot travis build for ccbut

SoCal Code Camp Slack bot - https://www.socalcodecamp.com/

Installation

In order to use ccbot with slack, you need to create a slack app. After creating an app, you need to get you API Token. That token needs to be added to an environment variable named 'SLACK_CODE_CAMP_BOT_TOKEN'

Install deps :

`pip install -r requirements.text` 

Start bot:

`ccbot/bot`

The bot should be up and running.

Note: If you would like the bot to work in private channels, you need to invite the bot to the channel.

Unit Tests

Run tests (from root of the project):

`pytest` 

To run tests continuously via pytest-watch:

`ptw`

Code Coverage

`./cover.sh`

Adding new Commands

Commands are automaticatlly loaded at startup. To add a new command, add a class in the commands folder. The class must include the following 3 method:

Method Description
get_channel_id(self) Returns the channel ID where this command can execute. It can also be "all" for any public or private channels which have ccbot as a member.
invoke(self, command, user) This method gets called everytime someone invokes the command. The command parameter contains the name of the command, and any other trailing arguments as a single string.
get_command(self) Text used to invoke command. The input can contain other characters after the command text.

Current Command List

  • campme <verb> - shows current code camp sessions and schedule. Try campme now for sessions in progress, campme next for sessions about to start, campme speaker Bob Bobbernaugh for session by Bob Bobbernaugh, campme sessions at 14:15 to show sessions today at 2:15PM (use 24 hour clock, hour and minutes only).
  • catme - shows a catgif from Edgecats
  • dogme - shows an image of a puppy
  • goatme - shows an image of a goat
  • tortoiseme - shows an image of a tortoise
  • aww - shows an image from /r/aww
  • teslame - shows an image of an intergallatic spaceboat of light and wonder. Note: It's TeslaME not tesLAME.
  • earthme - shows an image of the earth.
  • xkcd - shows a random xkcd comic
    • xkcd latest - shows the most recent xkcd comic
    • xkcd [number] - shows an xkcd comic by it's id. eg "xkcd 221" (which is one of my favorites)
  • tacome [zip code] - shows a random yelp business categorized 'tacotrucks' with term 'taco'
  • ccbot - generic ccbot command. ccbot must be invoked with a command in the form ccbot [command]. Commands are mapped to functions that start with "action_"
    • ccbot tell_joke - grabs a dad joke and displays the text
  • whome - shows an image related to Dr. Who.
  • AlfMe - A random Alf GIF.
  • BobMe - A random Spongebob Squarepants GIF.
  • ElfMe - A random Elf GIF.
  • HanukkahMe - A random Hanukkah GIF.
  • KillMe - A random Kill Bill GIF.
  • KwanzaaMe - A random Kwanzaa GIF.
  • MadMaxMe - A random Mad Max GIF.
  • MarxMe - A random Groucho Marx GIF.
  • StaloneMe - A random Silvester Stalone GIF.
  • StarTrekMe - A random StarTrek GIF.
  • StoogeMe - A random Three Stooges GIF.
  • UrkleMe - A random Steve Urkle GIF.
  • HelpMe - Shows available commands.
    • HelpMe [command] - More details about an individual command options (if documented). Try helpme urkleme

Image of ccbot invoking earthme and xkcd

About

SoCal Code Camp Slack bot

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages