Giter Site home page Giter Site logo

slack-tea's Introduction

Tea Bot

Can't decide who should make a brew? Let Slack do it for you

This uses the Slack API class created by 10w042 - the original can be found on GitHub. The class is included in this repo for ease of use.

This Outgoing WebHook takes the members of the channel to decide who should get up and make a round of tea. If you have members of the team that don't drink tea - then it might be worth making a dedicated channel.

Installation

  1. Download the PHP files and host them on an externally accessible URL
  2. Head to https://api.slack.com/web and (if you haven't already) scroll down and click the Create Token link
  3. Copy your token that is generated and paste it into the $auth_token variable at the top of tea.php
  4. Drop over to https://YOURTEAM.slack.com/services/new and right at the bottom, add the Outgoing WebHooks integration
  5. Create the WebHook with the following settings
    • Channel: Any (or your dedicated Tea channel)
    • Trigger Word(s): !tea (if you change this - remeber to change the $trigger_word var at the top of tea.php)
    • URL(s): The url of where your tea.php is
    • Descriptive Label: What ever you want
    • Customize Name: I called ours "Tea Bot"
    • Customize Icon: There is a tea icon in there somewhere!
  6. Save the settings!

Job Done!

If all has worked well, you should be able to type your trigger word into your designated channel and hey presto! A tea maker is selected.

Customisation

There are a couple variables at the top of tea.php - make sure you keep these updated.

$trigger_word - Make sure if your trigger word is anything other than !tea you update this variable.

$responses - feel free to update/change the responses, just us {{USER}} where you want the users name to appear.

Pass in an extra string

The tea bot allows you to pass in an extra paramter to exclude a tea maker. For example, if Tarquin had just made the round of tea - it would be unfair for him to be in the spinning for the next round:

!tea tarquin

This will select any other channel member except Tarquin. You get your tea, Tarquin doesn't make two rounds in a row! Everyone is happy (unless you get selected).

This does a very rudamentary strpos() and so could be slightly abused. Want a round of tea to be made but anyone with an m in their name is excluded?

!tea m

Todo

  • Add initial feedback to let the users know the Tea Bot is working
  • Use the Slack class to send back messages to the channel

slack-tea's People

Contributors

mikestreety avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

slack-tea's Issues

Three Shuffles

The only way I could get the script to work is if I removed two of the three shuffles on line 54 in tea.php. Not sure if this could be something to do with php version (I'm running 5.4).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.