瀏覽代碼

Fix broken commands, manager, and Data.

tags/v0.1^2
Ben Kurtovic 12 年之前
父節點
當前提交
7bdff82971
共有 6 個文件被更改,包括 22 次插入12 次删除
  1. +4
    -2
      earwigbot/commands/afc_pending.py
  2. +4
    -2
      earwigbot/commands/geolocate.py
  3. +4
    -2
      earwigbot/commands/langcode.py
  4. +4
    -2
      earwigbot/commands/time.py
  5. +2
    -2
      earwigbot/irc/data.py
  6. +4
    -2
      earwigbot/managers.py

+ 4
- 2
earwigbot/commands/afc_pending.py 查看文件

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

from earwigbot.commands import BaseCommand
from earwigbot.commands import Command

class Command(BaseCommand):
__all__ = ["AFCPending"]

class AFCPending(Command):
"""Link the user to the pending AFC submissions page and category."""
name = "pending"
commands = ["pending", "pend"]


+ 4
- 2
earwigbot/commands/geolocate.py 查看文件

@@ -23,9 +23,11 @@
import json
import urllib2

from earwigbot.commands import BaseCommand
from earwigbot.commands import Command

class Command(BaseCommand):
__all__ = ["Geolocate"]

class Geolocate(Command):
"""Geolocate an IP address (via http://ipinfodb.com/)."""
name = "geolocate"
commands = ["geolocate", "locate", "geo", "ip"]


+ 4
- 2
earwigbot/commands/langcode.py 查看文件

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

from earwigbot.commands import BaseCommand
from earwigbot.commands import Command

class Command(BaseCommand):
__all__ = ["Langcode"]

class Langcode(Command):
"""Convert a language code into its name and a list of WMF sites in that
language."""
name = "langcode"


+ 4
- 2
earwigbot/commands/time.py 查看文件

@@ -29,9 +29,11 @@ try:
except ImportError:
pytz = None

from earwigbot.commands import BaseCommand
from earwigbot.commands import Command

class Command(BaseCommand):
__all__ = ["Time"]

class Time(Command):
"""Report the current time in any timezone (UTC default), or in beats."""
name = "time"
commands = ["time", "beats", "swatch"]


+ 2
- 2
earwigbot/irc/data.py 查看文件

@@ -41,7 +41,7 @@ class Data(object):

def _parse(self, msgtype):
"""Parse a line from IRC into its components as instance attributes."""
sender = re.findall(":(.*?)!(.*?)@(.*?)\Z", line[0])[0]
sender = re.findall(":(.*?)!(.*?)@(.*?)\Z", self.line[0])[0]
self._nick, self._ident, self._host = sender
self._chan = self.line[2]

@@ -51,7 +51,7 @@ class Data(object):
# sender instead of the 'channel', which is ourselves:
self._chan = self._nick
self._is_private = True
self._msg = " ".join(line[3:])[1:]
self._msg = " ".join(self.line[3:])[1:]
self._parse_args()
self._parse_kwargs()



+ 4
- 2
earwigbot/managers.py 查看文件

@@ -95,8 +95,10 @@ class _ResourceManager(object):
f.close()

for obj in vars(module).values():
if type(obj) is type and isinstance(obj, self._resource_base):
self._load_resource(name, path, obj)
if type(obj) is type:
isresource = issubclass(obj, self._resource_base)
if isresource and not obj is self._resource_base:
self._load_resource(name, path, obj)

def _load_directory(self, dir):
"""Load all valid resources in a given directory."""


Loading…
取消
儲存