<commit_before># -*- coding: utf-8 -*-
"""
    Provides the ownbot AdminCommands class.
"""
from telegram.parsemode import ParseMode
from telegram.ext import CommandHandler

from ownbot.auth import requires_usergroup
from ownbot.user import User
from ownbot.usermanager import UserManager

class AdminCommands(object):
    """
        Provides admin command handlers for user/group
        management.

        Args:
            dispatcher (telegram.dispatcher): Command dispatcher to register the
                admin commands.
    """

    def __init__(self, dispatcher):
        self.__usermanager = UserManager()
        self.__dispatcher = dispatcher
        self.__register_handlers()

    def __register_handlers(self):
        """Registers the admin commands.
        """
        self.__dispatcher.addHandler(
            CommandHandler("adminhelp", self.__admin_help)
        )
        self.__dispatcher.addHandler(
            CommandHandler("users", self.__get_users)
        )
        self.__dispatcher.addHandler(
            CommandHandler("adduser", self.__add_user, pass_args=True)
        )
        self.__dispatcher.addHandler(
            CommandHandler("rmuser", self.__rm_user, pass_args=True)
        )

    def __admin_help(self, bot, update):
        """Command handler function for `adminhelp` command.

            Sends a list of all available commands to the
            client.
        """
        print(update.message.text)

    @staticmethod
    @requires_usergroup("admin")
    def __get_users(bot, update):
        """Command handler function for `users` command.

            Sends a list of all currently registered
            users.
<commit_msg>Add admin help handler to admincommands<commit_after># -*- coding: utf-8 -*-
"""
    Provides the ownbot AdminCommands class.
"""
from telegram.parsemode import ParseMode
from telegram.ext import CommandHandler

from ownbot.auth import requires_usergroup
from ownbot.usermanager import UserManager

class AdminCommands(object):  # pylint: disable=too-few-public-methods
    """
        Provides admin command handlers for user/group
        management.

        Args:
            dispatcher (telegram.dispatcher): Command dispatcher to register the
                admin commands.
    """

    def __init__(self, dispatcher):
        self.__usermanager = UserManager()
        self.__dispatcher = dispatcher
        self.__register_handlers()

    def __register_handlers(self):
        """Registers the admin commands.
        """
        self.__dispatcher.addHandler(
            CommandHandler("adminhelp", self.__admin_help)
        )
        self.__dispatcher.addHandler(
            CommandHandler("users", self.__get_users)
        )
        self.__dispatcher.addHandler(
            CommandHandler("adduser", self.__add_user, pass_args=True)
        )
        self.__dispatcher.addHandler(
            CommandHandler("rmuser", self.__rm_user, pass_args=True)
        )


    @staticmethod
    @requires_usergroup("admin")
    def __admin_help(bot, update):
        """Command handler function for `adminhelp` command.

            Sends a list of all available commands to the
            client.

            Args:
                bot (telegram.Bot): The bot object.
                update (telegram.Update): The sent update.
        """
        message = """
*Available Admin Commands*
/users - Lists all registered users.
/adduser - Adds a user to a group.
/rmuser - Removes a user from a group.
        """
        bot.sendMessage(chat_id=update.message.chat_id, text=message,
                        parse_mode=ParseMode.MARKDOWN)

    @staticmethod
    @requires_usergroup("admin")
    def __get_users(bot, update):
        """Command handler function for `users` command.

            Sends a list of all currently registered
            users.

{'fraction_non_alphanumeric': 0.08691126723913609, 'fraction_numerical': 0.0005204267499349467, 'mean_word_length': 2.342608695652174, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4297481', 'n_tokens_mistral': 1016, 'n_tokens_neox': 993, 'n_words': 270}