<commit_before><?php

use Dan\Contracts\UserContract;
use Dan\Irc\Connection;
use Dan\Irc\Location\Channel;
use Dan\Irc\Location\User;

command(['admins', 'owners', 'owner'])
    ->allowPrivate()
    ->rank('*')
    ->helpText('Lists bot admins and owners')
    ->handler(function (Connection $connection, UserContract $user, Channel $channel = null) {
        $location = $channel ?? $user;

        $users = $connection->database('users')->get();
        $owners = [];
        $admins = [];

        foreach ($users as $user) {
            $user = new User($connection, $user);

            if ($connection->isOwner($user)) {
                $owners[] = $user->nick;
            }

            if ($connection->isAdmin($user)) {
                $admins[] = $user->nick;
            }
        }

        $location->notice("Owners: ".implode(', ', $owners));
        $location->notice("Admins: ".implode(', ', $admins));
    });<commit_msg>Fix issue with admins command<commit_after><?php

use Dan\Contracts\UserContract;
use Dan\Irc\Connection;
use Dan\Irc\Location\Channel;
use Dan\Irc\Location\User;

command(['admins', 'owners', 'owner'])
    ->allowPrivate()
    ->rank('*')
    ->helpText('Lists bot admins and owners')
    ->handler(function (Connection $connection, UserContract $user, Channel $channel = null) {
        $method = $channel ? 'notice' : 'message';

        $users = $connection->database('users')->get();
        $owners = [];
        $admins = [];

        foreach ($users as $user) {
            $user = new User($connection, $user);

            if ($connection->isOwner($user)) {
                $owners[] = $user->nick;
            }

            if ($connection->isAdmin($user)) {
                $admins[] = $user->nick;
            }
        }

        $user->$method("Owners: ".implode(', ', $owners));
        $user->$method("Admins: ".implode(', ', $admins));
    });
{'fraction_non_alphanumeric': 0.18980021030494218, 'fraction_numerical': 0.0, 'mean_word_length': 2.3211169284467714, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, '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': '2247007', 'n_tokens_mistral': 582, 'n_tokens_neox': 559, 'n_words': 117}