dev stuff

This commit is contained in:
Ben Harris 2017-04-16 23:18:32 -04:00
parent b7a116c827
commit efe8853f16
2 changed files with 42 additions and 0 deletions

1
.gitignore vendored
View File

@ -2,6 +2,7 @@
uploaded_images/
bot_data/
.env
music/
# composer packages
vendor/
# unneccessary

41
src/Commands/AsciiArt.php Normal file
View File

@ -0,0 +1,41 @@
<?php
namespace BenBot\Commands;
use BenBot\Utils;
use Discord\Helpers\Process;
class AsciiArt {
private static $bot;
public static function register(&$that)
{
self::$bot = $that;
self::$bot->registerCommand('ascii', [__CLASS__, 'ascii'], [
'description' => 'creates ascii word art',
'usage' => '<words>',
]);
echo __CLASS__ . " registered", PHP_EOL;
}
public static function ascii($msg, $args)
{
$process = new Process('figlet hi');
$process->start(self::$bot->loop);
$response = "";
$process->stdout->on('data', function ($chunk) use (&$response) {
$response .= $chunk;
});
$process->on('exit', function ($code) use ($msg, $response) {
Utils::send($msg, $response);
});
}
}