GithubHelp home page GithubHelp logo

kcloze / swoole-bot Goto Github PK

View Code? Open in Web Editor NEW
414.0 30.0 90.0 670 KB

基于swoole实现的微信机器人,依赖vbot和微信网页版的功能,帮助管理微信群/聊天/踢人等

PHP 100.00%
swoole robot wechat

swoole-bot's Introduction

1. 简介

  • 项目原理: 模拟微信网页版登录,如果网页版本没有的功能,这个项目项目也是无能为力的
  • 该项目主要目的想利用swoole,增强原生PHP cli的能力,默认是daemon的守护进程模式
  • 直接使用hanson/vbot库,swoole-bot只是增加swoole版本的入口,这样有利用新功能迭代
  • 已经支持多用户登录,修改src/config.php 的workNum可以控制默认启动进程数
  • 自动监控子进程,意外退出后会自动恢复,保证服务稳定性

1.1 流程图

微信机器人执行流程图

2. 安装

2.1环境要求

  • PHP >= 7.0
  • swoole >= 1.8.9
  • vbot >= 2.0

2.2 安装方式

  • composer
composer require kcloze/swoole-bot
  • git
git clone https://github.com/kcloze/swoole-bot.git
cd swoole-bot
composer install

2.3 修改配置项

2.4 管理服务


php run.php start|stop

3. 体验demo

  • 微信添加微信好友:ysrg2014
  • 输入验证关键字:666
  • 对话输入自己想说的话,微信机器人机会跟您聊天了

效果截图1

4. 文档

5. 参考项目

hanson/vbot

6. 感谢

7. QQ群

  • 141059677

swoole-bot's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

swoole-bot's Issues

composer安装时报错: aferrandini/phpqrcode is abandoned

相关控制台信息:

Installs: aferrandini/phpqrcode:1.0.1
  - Installing aferrandini/phpqrcode (1.0.1): Reading /Users/xt/.composer/cache/files/aferrandini/phpqrcode/8a6e6865b1fb9d5814a0fefa154b92df802b7e48.zip from cache
Loading from cache
 Extracting archiveExecuting command (CWD): unzip -qq  '/Volumes/Code/wxbot/vendor/aferrandini/phpqrcode/3d98ea181a514f0970cde739b9e03dd7' -d '/Volumes/Code/wxbot/vendor/composer/b37fcf9a'
    REASON: hanson/vbot 2.0.14 requires aferrandini/phpqrcode ^1.0 -> satisfiable by aferrandini/phpqrcode[1.0.0, 1.0.1].

Package aferrandini/phpqrcode is abandoned, you should avoid using it. Use endroid/qr-code instead.
Reading /Volumes/Code/wxbot/vendor/composer/installed.json
Reading ./composer.lock
Writing lock file
Generating autoload files
Carbon 1 is deprecated, see how to migrate to Carbon 2.
https://carbon.nesbot.com/docs/#api-carbon-2
    You can run './vendor/bin/upgrade-carbon' to get help in updating carbon and other frameworks and libraries that depend on it.
Endroid Installer detected project type "all"

运行时的报错,关于RedisManager无法构造的问题

控制台报错如下:

vbot.ERROR: Too few arguments to function Illuminate\Redis\RedisManager::__construct(), 2 passed in /www/wwwroot/bot.21b.cn/vendor/hanson/vbot/src/Foundation/ServiceProviders/CacheServiceProvider.php on line 31 and exactly 3 expected [] []
PHP Fatal error:  Uncaught TypeError: Argument 1 passed to Hanson\Vbot\Foundation\ExceptionHandler::report() must be an instance of Exception, instance of ArgumentCountError given, called in /www/wwwroot/bot.21b.cn/vendor/hanson/vbot/src/Foundation/ExceptionHandler.php on line 133 and defined in /www/wwwroot/bot.21b.cn/vendor/hanson/vbot/src/Foundation/ExceptionHandler.php:58

CacheServiceProvider.php Line 31如下:

return new RedisManager(array_get($config, 'client', 'predis'), $config);

RedisManager.php 构造方法如下:

    public function __construct($app, $driver, array $config)
    {
        $this->app = $app;
        $this->driver = $driver;
        $this->config = $config;
    }

请问,确定没错吗

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.