| @@ -20,9 +20,11 @@ | |||||
| # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||||
| # SOFTWARE. | # 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.""" | """Link the user to the pending AFC submissions page and category.""" | ||||
| name = "pending" | name = "pending" | ||||
| commands = ["pending", "pend"] | commands = ["pending", "pend"] | ||||
| @@ -23,9 +23,11 @@ | |||||
| import json | import json | ||||
| import urllib2 | 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/).""" | """Geolocate an IP address (via http://ipinfodb.com/).""" | ||||
| name = "geolocate" | name = "geolocate" | ||||
| commands = ["geolocate", "locate", "geo", "ip"] | commands = ["geolocate", "locate", "geo", "ip"] | ||||
| @@ -20,9 +20,11 @@ | |||||
| # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||||
| # SOFTWARE. | # 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 | """Convert a language code into its name and a list of WMF sites in that | ||||
| language.""" | language.""" | ||||
| name = "langcode" | name = "langcode" | ||||
| @@ -29,9 +29,11 @@ try: | |||||
| except ImportError: | except ImportError: | ||||
| pytz = None | 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.""" | """Report the current time in any timezone (UTC default), or in beats.""" | ||||
| name = "time" | name = "time" | ||||
| commands = ["time", "beats", "swatch"] | commands = ["time", "beats", "swatch"] | ||||
| @@ -41,7 +41,7 @@ class Data(object): | |||||
| def _parse(self, msgtype): | def _parse(self, msgtype): | ||||
| """Parse a line from IRC into its components as instance attributes.""" | """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._nick, self._ident, self._host = sender | ||||
| self._chan = self.line[2] | self._chan = self.line[2] | ||||
| @@ -51,7 +51,7 @@ class Data(object): | |||||
| # sender instead of the 'channel', which is ourselves: | # sender instead of the 'channel', which is ourselves: | ||||
| self._chan = self._nick | self._chan = self._nick | ||||
| self._is_private = True | self._is_private = True | ||||
| self._msg = " ".join(line[3:])[1:] | |||||
| self._msg = " ".join(self.line[3:])[1:] | |||||
| self._parse_args() | self._parse_args() | ||||
| self._parse_kwargs() | self._parse_kwargs() | ||||
| @@ -95,8 +95,10 @@ class _ResourceManager(object): | |||||
| f.close() | f.close() | ||||
| for obj in vars(module).values(): | 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): | def _load_directory(self, dir): | ||||
| """Load all valid resources in a given directory.""" | """Load all valid resources in a given directory.""" | ||||