Ver código fonte

Add !version (closes #56)

tags/v0.2
Ben Kurtovic 8 anos atrás
pai
commit
7957061580
2 arquivos alterados com 12 adições e 2 exclusões
  1. +1
    -0
      CHANGELOG
  2. +11
    -2
      earwigbot/commands/help.py

+ 1
- 0
CHANGELOG Ver arquivo

@@ -7,6 +7,7 @@ v0.2 (unreleased):
- Added !stalk/!watch.
- Added !watchers.
- Added !epoch as a subcommand of !time.
- Added !version as a subcommand of !help.
- Expanded and improved !remind.
- Improved general behavior of !access and !threads.
- Fixed API behavior when blocked, when using AssertEdit, and under other


+ 11
- 2
earwigbot/commands/help.py Ver arquivo

@@ -20,17 +20,20 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

from platform import python_version
import re

from earwigbot import __version__
from earwigbot.commands import Command

class Help(Command):
"""Displays help information."""
"""Displays information about the bot."""
name = "help"
commands = ["help", "version"]

def check(self, data):
if data.is_command:
if data.command == "help":
if data.command in self.commands:
return True
if not data.command and data.trigger == data.my_nick:
return True
@@ -39,6 +42,8 @@ class Help(Command):
def process(self, data):
if not data.command:
self.do_hello(data)
elif data.command == "version":
self.do_version(data)
elif data.args:
self.do_command_help(data)
else:
@@ -69,3 +74,7 @@ class Help(Command):

def do_hello(self, data):
self.say(data.chan, "Yes, {0}?".format(data.nick))

def do_version(self, data):
vers = "EarwigBot v{bot} on Python {python}: https://github.com/earwig/earwigbot"
self.reply(data, vers.format(bot=__version__, python=python_version()))

Carregando…
Cancelar
Salvar