idevelopthings / laravel-twitch-irc
这是我的包 laravel-twitch-irc
dev-main
2023-07-03 20:18 UTC
Requires
- php: ^8.0
- amphp/websocket-client: ^1.0
- bensampo/laravel-enum: ^4.1
- illuminate/contracts: ^8.73
- spatie/laravel-package-tools: ^1.9.2
Requires (Dev)
- nunomaduro/collision: ^5.10
- nunomaduro/larastan: ^1.0
- orchestra/testbench: ^6.22
- pestphp/pest: ^1.21
- pestphp/pest-plugin-laravel: ^1.1
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- phpunit/phpunit: ^9.5
- spatie/laravel-ray: ^1.26
This package is auto-updated.
Last update: 2024-09-09 22:52:15 UTC
README
laravel应用程序的Twitch IRC机器人。它自带创建自定义命令的能力,包括别名、冷却时间、连接到多个频道等。
安装
您可以通过composer安装此包
composer require idevelopthings/laravel-twitch-irc
您可以使用以下命令发布配置文件
php artisan vendor:publish --tag="twitch-irc-config"
用法
首先发布配置文件,添加到您的.env文件中
TWITCH_BOT_USERNAME="your bots username" TWITCH_BOT_ACCESS_TOKEN="your bots token"
您可以从这里获取令牌:[https://twitchapps.com/tmi/](https://twitchapps.com/tmi/) 使用令牌时,不要包含 "oauth:" 前缀。
现在我们可以创建一个命令,默认位置是 app/Services/TwitchIrc/Commands,您可以在配置文件中更改此路径
<?php namespace App\Services\TwitchIrc\Commands; use TwitchIrc\Bot\Command\BaseCommand; class HelloWorldCommand extends BaseCommand { public function identifier(): string { return "hello"; } public function aliases(): array { return [ 'hi', 'hw', 'helloworld', ]; } public function description(): string { return "Responds with hello world."; } public function handle(): void { $this->reply('Hello world.'); } }
现在您可以通过运行 "php artisan twitchbot" 来启动机器人。我们还可以使用 "php artisan twitchbot --stop" 来停止机器人,这在CI设置中很有用。
测试
composer test
变更日志
请参阅变更日志了解最近的变化信息。
贡献
请参阅贡献指南了解详细信息。
安全漏洞
请查阅我们的安全策略了解如何报告安全漏洞。
鸣谢
许可
MIT许可(MIT)。有关更多信息,请参阅许可文件。