[wip] in modules, changes import to reflect new directory structure

This commit is contained in:
nemunaire 2015-01-03 20:34:44 +01:00
parent 5a6230d844
commit 7c7b63634b
39 changed files with 87 additions and 86 deletions

View File

@ -7,8 +7,8 @@ import sys
from datetime import datetime, timezone from datetime import datetime, timezone
import shlex import shlex
from hooks import hook from nemubot.hooks import hook
from message import TextMessage, Command from nemubot.message import TextMessage, Command
nemubotversion = 3.4 nemubotversion = 3.4

View File

@ -6,10 +6,10 @@ import re
import sys import sys
from datetime import date, datetime from datetime import date, datetime
from hooks import hook from nemubot.hooks import hook
from tools.countdown import countdown_format from nemubot.tools.countdown import countdown_format
from tools.date import extractDate from nemubot.tools.date import extractDate
from tools.xmlparser.node import ModuleState from nemubot.tools.xmlparser.node import ModuleState
nemubotversion = 3.4 nemubotversion = 3.4

View File

@ -4,8 +4,8 @@
from datetime import datetime, timezone from datetime import datetime, timezone
from hooks import hook from nemubot.hooks import hook
from tools.countdown import countdown_format from nemubot.tools.countdown import countdown_format
nemubotversion = 3.4 nemubotversion = 3.4

View File

@ -4,8 +4,8 @@
import urllib import urllib
from hooks import hook from nemubot.hooks import hook
from tools import web from nemubot.tools import web
nemubotversion = 3.4 nemubotversion = 3.4

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Nemubot is a modulable IRC bot, built around XML configuration files. # Nemubot is a smart and modulable IM bot.
# Copyright (C) 2012 Mercier Pierre-Olivier # Copyright (C) 2012-2015 Mercier Pierre-Olivier
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
@ -19,10 +19,10 @@
import traceback import traceback
import sys import sys
from prompt.error import PromptError from nemubot.prompt.error import PromptError
from hooks import hook from nemubot.hooks import hook
from message import TextMessage from nemubot.message import TextMessage
from networkbot import NetworkBot from nemubot.networkbot import NetworkBot
nemubotversion = 3.4 nemubotversion = 3.4
NODATA = True NODATA = True

View File

@ -2,15 +2,13 @@
"""Find french conjugaison""" """Find french conjugaison"""
from collections import defaultdict
import re import re
import traceback
import sys
from urllib.parse import quote from urllib.parse import quote
from hooks import hook from nemubot.hooks import hook
from tools import web from nemubot.tools import web
from tools.web import striphtml from nemubot.tools.web import striphtml
from collections import defaultdict
nemubotversion = 3.4 nemubotversion = 3.4

View File

@ -1,7 +1,7 @@
import urllib.request import urllib.request
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
import pprint import pprint
from hooks import hook from nemubot.hooks import hook
from more import Response from more import Response
nemubotversion = 3.4 nemubotversion = 3.4
@ -34,4 +34,3 @@ def get_cve_desc(msg):
desc = soup.body.findAll('td') desc = soup.body.findAll('td')
return Response(desc[DESC_INDEX].text, msg.channel) return Response(desc[DESC_INDEX].text, msg.channel)

View File

@ -2,8 +2,8 @@
from urllib.parse import quote from urllib.parse import quote
from tools import web from nemubot.tools import web
from tools.xmlparser import parse_string from nemubot.tools.xmlparser import parse_string
class DDGSearch: class DDGSearch:

View File

@ -2,7 +2,7 @@
from urllib.parse import quote from urllib.parse import quote
from tools import web from nemubot.tools import web
class UrbanDictionnary: class UrbanDictionnary:

View File

@ -2,7 +2,7 @@
from urllib.parse import quote from urllib.parse import quote
from tools import web from nemubot.tools import web
class WFASearch: class WFASearch:

View File

@ -4,7 +4,7 @@
import imp import imp
from hooks import hook from nemubot.hooks import hook
nemubotversion = 3.4 nemubotversion = 3.4

View File

@ -10,10 +10,10 @@ import time
import threading import threading
import traceback import traceback
from event import ModuleEvent from nemubot.event import ModuleEvent
from hooks import hook from nemubot.hooks import hook
from tools.date import extractDate from nemubot.tools.date import extractDate
from tools.countdown import countdown_format, countdown from nemubot.tools.countdown import countdown_format, countdown
nemubotversion = 3.4 nemubotversion = 3.4

View File

@ -5,8 +5,8 @@
import re import re
from urllib.parse import quote from urllib.parse import quote
from hooks import hook from nemubot.hooks import hook
from tools import web from nemubot.tools import web
nemubotversion = 3.4 nemubotversion = 3.4

View File

@ -5,8 +5,8 @@
import re import re
import urllib.parse import urllib.parse
from hooks import hook from nemubot.hooks import hook
from tools import web from nemubot.tools import web
nemubotversion = 3.4 nemubotversion = 3.4

View File

@ -6,7 +6,7 @@ import subprocess
import re import re
import os import os
from hooks import hook from nemubot.hooks import hook
nemubotversion = 3.4 nemubotversion = 3.4

View File

@ -5,7 +5,7 @@
import re import re
from urllib.parse import quote from urllib.parse import quote
from tools import web from nemubot.tools import web
nemubotversion = 3.4 nemubotversion = 3.4
@ -20,7 +20,7 @@ def load(context):
"http://developer.mapquest.com/") "http://developer.mapquest.com/")
return None return None
from hooks.messagehook import MessageHook from nemubot.hooks.messagehook import MessageHook
add_hook("cmd_hook", MessageHook(cmd_geocode, "geocode")) add_hook("cmd_hook", MessageHook(cmd_geocode, "geocode"))

View File

@ -6,8 +6,8 @@ import json
import re import re
import urllib.parse import urllib.parse
from hooks import hook from nemubot.hooks import hook
from tools import web from nemubot.tools import web
nemubotversion = 3.4 nemubotversion = 3.4

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Nemubot is a smart and modulable IM bot. # Nemubot is a smart and modulable IM bot.
# Copyright (C) 2012-2014 nemunaire # Copyright (C) 2012-2015 Mercier Pierre-Olivier
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
@ -20,8 +20,8 @@
import logging import logging
from message import TextMessage, DirectAsk from nemubot.message import TextMessage, DirectAsk
from hooks import hook from nemubot.hooks import hook
nemubotversion = 3.4 nemubotversion = 3.4

View File

@ -2,7 +2,7 @@
"""Various network tools (w3m, w3c validator, curl, traceurl, ...)""" """Various network tools (w3m, w3c validator, curl, traceurl, ...)"""
from hooks import hook from nemubot.hooks import hook
nemubotversion = 3.4 nemubotversion = 3.4

View File

@ -1,6 +1,6 @@
import urllib import urllib
from tools.web import getJSON from nemubot.tools.web import getJSON
def isup(url): def isup(url):
"""Determine if the given URL is up or not """Determine if the given URL is up or not

View File

@ -4,8 +4,8 @@ import subprocess
import tempfile import tempfile
import urllib import urllib
from bot import __version__ from nemubot import __version__
from tools import web from nemubot.tools import web
def load(CONF, add_hook): def load(CONF, add_hook):

View File

@ -1,6 +1,8 @@
import json import json
import urllib import urllib
from nemubot import __version__
def validator(url): def validator(url):
"""Run the w3c validator on the given URL """Run the w3c validator on the given URL
@ -15,7 +17,7 @@ def validator(url):
raise IRCException("Indiquer une URL valide !") raise IRCException("Indiquer une URL valide !")
try: try:
req = urllib.request.Request("http://validator.w3.org/check?uri=%s&output=json" % (urllib.parse.quote(o.geturl())), headers={ 'User-Agent' : "nemubot v3" }) req = urllib.request.Request("http://validator.w3.org/check?uri=%s&output=json" % (urllib.parse.quote(o.geturl())), headers={ 'User-Agent' : "Nemubot v%s" % __version__})
raw = urllib.request.urlopen(req, timeout=10) raw = urllib.request.urlopen(req, timeout=10)
except urllib.error.HTTPError as e: except urllib.error.HTTPError as e:
raise IRCException("HTTP error occurs: %s %s" % (e.code, e.reason)) raise IRCException("HTTP error occurs: %s %s" % (e.code, e.reason))

View File

@ -4,12 +4,13 @@ from random import randint
import urllib.parse import urllib.parse
from urllib.parse import urlparse from urllib.parse import urlparse
from hooks import hook from nemubot.hooks import hook
from more import Response from nemubot.tools.xmlparser.node import ModuleState
from tools.xmlparser.node import ModuleState
nemubotversion = 3.4 nemubotversion = 3.4
from more import Response
from .atom import Atom from .atom import Atom
from . import page from . import page

View File

@ -1,8 +1,9 @@
import datetime import datetime
import urllib import urllib
from nemubot.tools.web import getJSON
from more import Response from more import Response
from tools.web import getJSON
URL_WHOIS = "http://www.whoisxmlapi.com/whoisserver/WhoisService?rid=1&domainName=%%s&outputFormat=json&userName=%s&password=%s" URL_WHOIS = "http://www.whoisxmlapi.com/whoisserver/WhoisService?rid=1&domainName=%%s&outputFormat=json&userName=%s&password=%s"
@ -17,7 +18,7 @@ def load(CONF, add_hook):
else: else:
URL_WHOIS = URL_WHOIS % (urllib.parse.quote(CONF.getNode("whoisxmlapi")["username"]), urllib.parse.quote(CONF.getNode("whoisxmlapi")["password"])) URL_WHOIS = URL_WHOIS % (urllib.parse.quote(CONF.getNode("whoisxmlapi")["username"]), urllib.parse.quote(CONF.getNode("whoisxmlapi")["password"]))
from hooks.messagehook import MessageHook from nemubot.hooks.messagehook import MessageHook
add_hook("cmd_hook", MessageHook(cmd_whois, "netwhois")) add_hook("cmd_hook", MessageHook(cmd_whois, "netwhois"))

View File

@ -2,7 +2,7 @@
"""Informe les usagers des prochains passages des transports en communs de la RATP""" """Informe les usagers des prochains passages des transports en communs de la RATP"""
from hooks import hook from nemubot.hooks import hook
from more import Response from more import Response
nemubotversion = 3.4 nemubotversion = 3.4

View File

@ -4,11 +4,11 @@
import re import re
from tools import web from nemubot.hooks import hook
from nemubot.tools import web
nemubotversion = 3.4 nemubotversion = 3.4
from hooks import hook
from more import Response from more import Response

View File

@ -4,7 +4,7 @@
import random import random
from hooks import hook from nemubot.hooks import hook
nemubotversion = 3.4 nemubotversion = 3.4

View File

@ -5,9 +5,9 @@
import re import re
import urllib.parse import urllib.parse
from hooks import hook from nemubot.hooks import hook
from tools import web from nemubot.tools import web
from tools.web import striphtml from nemubot.tools.web import striphtml
nemubotversion = 3.4 nemubotversion = 3.4

View File

@ -6,7 +6,7 @@ import re
import imp import imp
from datetime import datetime, timedelta, timezone from datetime import datetime, timedelta, timezone
from hooks import hook from nemubot.hooks import hook
nemubotversion = 3.4 nemubotversion = 3.4

View File

@ -9,7 +9,7 @@ import urllib.error
import urllib.request import urllib.request
import urllib.parse import urllib.parse
from hooks import hook from nemubot.hooks import hook
nemubotversion = 3.4 nemubotversion = 3.4

View File

@ -6,9 +6,9 @@ import re
import subprocess import subprocess
from threading import Thread from threading import Thread
from hooks import hook from nemubot.hooks import hook
from message import TextMessage from nemubot.message import TextMessage
from message.visitor import AbstractVisitor from nemubot.message.visitor import AbstractVisitor
nemubotversion = 3.4 nemubotversion = 3.4

View File

@ -5,7 +5,7 @@
import re import re
from urllib.parse import quote from urllib.parse import quote
from hooks import hook from nemubot.hooks import hook
from .pyaspell import Aspell from .pyaspell import Aspell
from .pyaspell import AspellError from .pyaspell import AspellError

View File

@ -5,8 +5,8 @@
import re import re
from urllib.parse import quote from urllib.parse import quote
from hooks import hook from nemubot.hooks import hook
from tools import web from nemubot.tools import web
nemubotversion = 3.4 nemubotversion = 3.4

View File

@ -1,12 +1,12 @@
from datetime import datetime from datetime import datetime
import urllib import urllib
from tools import human from nemubot.hooks import hook
from tools.web import getJSON from nemubot.tools import human
from nemubot.tools.web import getJSON
nemubotversion = 3.4 nemubotversion = 3.4
from hooks import hook
from more import Response from more import Response
URL_TPBAPI = None URL_TPBAPI = None
@ -22,7 +22,7 @@ def load(context):
else: else:
URL_TPBAPI = CONF.getNode("tpbapi")["url"] URL_TPBAPI = CONF.getNode("tpbapi")["url"]
from hooks.messagehook import MessageHook from nemubot.hooks.messagehook import MessageHook
add_hook("cmd_hook", MessageHook(cmd_tpb, "tpb")) add_hook("cmd_hook", MessageHook(cmd_tpb, "tpb"))

View File

@ -5,7 +5,7 @@
import re import re
from urllib.parse import quote from urllib.parse import quote
from tools import web from nemubot.tools import web
nemubotversion = 3.4 nemubotversion = 3.4
@ -27,7 +27,7 @@ def load(context):
else: else:
URL = URL % CONF.getNode("wrapi")["key"] URL = URL % CONF.getNode("wrapi")["key"]
from hooks.messagehook import MessageHook from nemubot.hooks.messagehook import MessageHook
add_hook("cmd_hook", MessageHook(cmd_translate, "translate")) add_hook("cmd_hook", MessageHook(cmd_translate, "translate"))

View File

@ -4,8 +4,8 @@
import re import re
from hooks import hook from nemubot.hooks import hook
from tools import web from nemubot.tools import web
nemubotversion = 3.4 nemubotversion = 3.4

View File

@ -6,8 +6,8 @@ import datetime
import re import re
from urllib.parse import quote from urllib.parse import quote
from hooks import hook from nemubot.hooks import hook
from tools import web from nemubot.tools import web
import mapquest import mapquest
@ -27,7 +27,7 @@ def load(context):
"http://developer.forecast.io/") "http://developer.forecast.io/")
return None return None
from hooks.messagehook import MessageHook from nemubot.hooks.messagehook import MessageHook
add_hook("cmd_hook", MessageHook(cmd_weather, "météo")) add_hook("cmd_hook", MessageHook(cmd_weather, "météo"))
add_hook("cmd_hook", MessageHook(cmd_alert, "alert")) add_hook("cmd_hook", MessageHook(cmd_alert, "alert"))
add_hook("cmd_hook", MessageHook(cmd_coordinates, "coordinates")) add_hook("cmd_hook", MessageHook(cmd_coordinates, "coordinates"))

View File

@ -8,12 +8,12 @@ import re
from urllib.parse import quote from urllib.parse import quote
from urllib.request import urlopen from urllib.request import urlopen
from nemubot.hooks import hook
nemubotversion = 3.4 nemubotversion = 3.4
from more import Response from more import Response
from hooks import hook
API_URL="http://worldcup.sfg.io/%s" API_URL="http://worldcup.sfg.io/%s"
def load(context): def load(context):

View File

@ -6,9 +6,9 @@ import re
from urllib.parse import urlparse from urllib.parse import urlparse
from urllib.parse import quote from urllib.parse import quote
from hooks import hook from nemubot.hooks import hook
from message import TextMessage from nemubot.message import TextMessage
from tools import web from nemubot.tools import web
nemubotversion = 3.4 nemubotversion = 3.4