GithubHelp home page GithubHelp logo

bearychat's Introduction

bearychat

bearychat robot message api

Install

composer require quhang/bearychat

Usage

$message = new \Quhang\BearyChat\Message($webhook);

$attachment = new \Quhang\BearyChat\Attachment([
    'title' => 'title_1',
    'url' => 'https://bearychat.com',
    'text' => 'attachment_text',
    'color' => '#ffa500',
    'images' => ['url' => 'http://img3.douban.com/icon/ul15067564-30.jpg'],
]);

# or
# $attachment = new \Quhang\BearyChat\Attachment();
# $attachment->title('title_1')
#    ->url('https://bearychat.com')
#    ->text('attachment_text')
#    ->color('#ffa500')
#    ->image('http://img3.douban.com/icon/ul15067564-30.jpg');

$message->send();

Laravel

laravel 5.5+

  1. you can publish config, then set your webhook in .env BEARYCHAT_WEBHOOK. This is unnecessary.
php artisan vendor:publish
  1. 使用 BearyChat to send message. BearyChat is a \Quhang\BearyChat\Message instance.
\Quhang\BearyChat\BearyChat::text('hello')->send()

laravel 5.1 ~ 5.4

  1. if you want to config your webhook, you need add Quhang\BearyChat\LaravelServiceProvider to config/app.php
'providers' => [
    // ...
    Quhang\BearyChat\LaravelServiceProvider::class,
    // ...
]
  1. if you want to use Facade, you need add Quhang\BearyChat\BearyChat to config/app.php
'aliases' => [
    // ...
    'BearyChat' => Quhang\BearyChat\BearyChat::class,
    // ...
]

Methods

function text(string $text); # set text
function notification(bool $need = true); # notification control
function markdown(bool $need = true); # markdown control
function channel(string $name); # set channel name
function to(string $username); # send to someone
function attachment(Attachment $attach); # append a attachment
function appendAttachment(Attachment $attach); # alias attachment
function webhook($webhook); # set webhook url
function send(bool $need = true); # send

License

MIT

bearychat's People

Contributors

zm-john avatar

Stargazers

 avatar

Watchers

 avatar

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.