orukusaki/slackbundle 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

orukusaki/slackbundle

Composer 安装命令:

composer require orukusaki/slackbundle

包简介

Symfony2 Bundle for communicating with the Slack API

README 文档

README

Build Status

This bundle provides

  • A Guzzle client to access the Slack API
  • A Cli command to monitor a group on an event loop, dispatching events to handle messages received.
  • Controllers for recieving slash commands and outgoing webhooks
  • A Behat context class to help with functional testing of your bot

This bundle is very much in alpha status

Installation

composer require 'orukusaki/slackbundle'

Add these lines you your AppKernal::registerBundles

...
new Orukusaki\Bundle\SlackBundle\OrukusakiSlackBundle(),
new Misd\GuzzleBundle\MisdGuzzleBundle(),
...

Add config to config.yml:

orukusaki_slack:
    api_key: <Your API Key>
    identity:
        username: My Api Bot
        emoji: ":space_invader:"

Recieving Slash commands and webhooks

Add the bundle to your routing.yml

orukusaki_slack:
    resource: "@OrukusakiSlackBundle/Controller/"
    type:     annotation
    prefix:   /slack

In the Slack Integrations page, create a slash command pointing to /slack/slashcommand or a webhook pointing to /slack/webhook

Running as a Bot

app/console slack:run < group name >

Adding your own commands

Add an Event Listener which will be triggered every time a message is received. There are a couple of examples in the services.xml for this bundle:

<service id="slack.listener.sayhi" class="Orukusaki\Bundle\SlackBundle\Listener\SayHiListener">
    <argument type="service" id="slack.client" />
    <tag name="kernel.event_listener" event="slack.message.received" method="handleMessageEvent" />
</service>

To see what commands you can run against the API, have a look at Resources/config/webservices.xml

Behat Context

This bundle includes a Behat context to help you create functional tests for your bot. To use it, you much first enable the Symfony2 Behat extension in your behat.yml:

composer require "behat/symfony2-extension" "*"

In behat.yml:

default:
    extensions:
        Behat\Symfony2Extension\Extension: ~

Then in the constructor of your FeatureContext, import the SlackContext:

$this->useContext('slack', new \Orukusaki\Bundle\SlackBundle\Context\SlackContext());

Use

bin/behat -dl

To see the steps now available to you.

Contributing

Any bug reports / feature requests should be raised on this github page

PRs are welcome, please branch from master, and run your code through phpcs (PSR-2 standard) and phpcs-fixer before submitting.

统计信息

  • 总下载量: 261
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 10
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 10
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-02-27

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固