wardellbagby / HangoutsBot

Python 3 Bot for Hangouts
GNU General Public License v3.0
38 stars 25 forks source link

Filter /help for available commands #21

Closed cntrlwiz closed 9 years ago

cntrlwiz commented 9 years ago

I didn't want the users trying every command in the help, so I borrowed check_if_can_run_command from Handlers, and put it into UtilBot for /help to access.

Modified /help command to loop through all commands, and create a commands_test list from the commands that pass the check. This list is then used in the docstring.

The user is now presented ONLY those commands that the user can run.

https://github.com/cntrlwiz/IngressBot/pull/13

Torf commented 9 years ago

Don't we get same result using hidden commands ?

cntrlwiz commented 9 years ago

Not really. "Hidden" commands are code-driven and bot-wide. I wanted to be able to configure them with config.json per conversation. Some of my hangouts are dead serious, and some are for fun. I will 'admin' the fun functions in the serious hangouts.

I thought about creating another tier of commands, "admin-hidden", but that got muddy really fast. It was easier to just hide the admin commands from those users who can't use them anyway.

wardellbagby commented 9 years ago

I like this. Can you go ahead and submit a pull request for it?