<commit_before><?php
namespace BenBot\Commands;
error_reporting(-1);

use BenBot\Utils;

class Images {

    private static $bot;

    public static function register(&$that)
    {
        self::$bot = $that;

        $img = self::$bot->registerCommand('img', [__CLASS__, 'img'], [
            'description' => 'save and retrieve images',
            'usage' => '<name of image to show|list|save|rm>',
            'registerHelp' => true,
        ]);
            $img->registerSubCommand('save', [__CLASS__, 'save'], [
                'description' => 'saves attached image',
                'usage' => '<name>',
            ]);
            $img->registerSubCommand('list', [__CLASS__, 'listImgs'], [
                'description' => 'lists all saved images',
            ]);
            $img->registerSubCommand('rm', [__CLASS__, 'delImg'], [
                'description' => 'deletes a saved image',
                'usage' => '<image name>',
                'aliases' => [
                    'del',
                    'remove',
                    'delete',
                ],
            ]);

        echo __CLASS__ . " registered", PHP_EOL;
    }



    public static function img($msg, $args)
    {
        if (isset($args[0])) {
            $imgname = strtolower($args[0]);
            if (isset(self::$bot->imgs[$imgname])) {
                Utils::sendFile(
                    $msg,
                    self::$bot->dir . "/uploaded_images/" . self::$bot->imgs[$imgname],
                    self::$bot->imgs[$imgname],
                    "$imgname\nby {$msg->author}"
                )->then(function ($result) use ($msg) {<commit_msg>broadcast typing for ;img:<commit_after><?php
namespace BenBot\Commands;
error_reporting(-1);

use BenBot\Utils;

class Images {

    private static $bot;

    public static function register(&$that)
    {
        self::$bot = $that;

        $img = self::$bot->registerCommand('img', [__CLASS__, 'img'], [
            'description' => 'save and retrieve images',
            'usage' => '<name of image to show|list|save|rm>',
            'registerHelp' => true,
        ]);
            $img->registerSubCommand('save', [__CLASS__, 'save'], [
                'description' => 'saves attached image',
                'usage' => '<name>',
            ]);
            $img->registerSubCommand('list', [__CLASS__, 'listImgs'], [
                'description' => 'lists all saved images',
            ]);
            $img->registerSubCommand('rm', [__CLASS__, 'delImg'], [
                'description' => 'deletes a saved image',
                'usage' => '<image name>',
                'aliases' => [
                    'del',
                    'remove',
                    'delete',
                ],
            ]);

        echo __CLASS__ . " registered", PHP_EOL;
    }



    public static function img($msg, $args)
    {
        if (isset($args[0])) {
            $imgname = strtolower($args[0]);
            if (isset(self::$bot->imgs[$imgname])) {
                $msg->channel->broadcastTyping();
                Utils::sendFile(
                    $msg,
                    self::$bot->dir . "/uploaded_images/" . self::$bot->imgs[$imgname],
                    self::$bot->imgs[$imgname],
                    "$imgname\nby {$msg->author}"
                )->then(function ($result) use ($msg) {
{'fraction_non_alphanumeric': 0.1656240691093238, 'fraction_numerical': 0.0017873100983020554, 'mean_word_length': 1.6051202482544609, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 49, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4518308', 'n_tokens_mistral': 938, 'n_tokens_neox': 918, 'n_words': 190}