funkymed / bender-slack-bot

a slack bot with command and plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bender Slack Bot

Author

Cyril Pereira cyril.pereira@gmail.com

Configuration

$ docker-compose up -d 
$ docker exec -it bender_php composer install --no-interaction --optimize-autoloader --quiet

Installation

Put anywhere on a server On your slack team area go to /services/new Add an Outgoing WebHooks

Select a channel, trigger words must be not filled

Put a complete url with the index.php on it ex: http://www.yourserver/bender

and that it

Go to your channel page en type !help

Create your own plugin

create a service :

<?php
namespace BenderBundle\Service;

/**
 * Class YourService
 * @package BenderBundle\Service
 */
class YourService extends BaseService
{
    /**
     * @var string
     */
    protected $hook = '!yourservice';
    /**
     * @return string
     */
    public function getHelp()
    {
        return '!yourservice test';
    }
    /**
     * @param $text
     * @return array|string
     */
    public function getMessage($text)
    {
        return "ok";
    }
    protected function getAnswer($message){
        return $message;
    }
}

add your service to symfony in the config file and set a tag name : bender.service

    bender.allocine:
       class: BenderBundle\Service\YourService
       arguments: ["@bender.factory"]
       tags:
           -  { name: bender.services }

the class will automatically found and executed in your channel if you type !help you will found your !tigger

About

a slack bot with command and plugin


Languages

Language:PHP 92.4%Language:HTML 5.8%Language:CSS 1.6%Language:Shell 0.2%