[wip] changes import to reflect new directory structure

This commit is contained in:
nemunaire 2015-01-03 20:17:46 +01:00
parent 41f7dc2456
commit 5a6230d844
31 changed files with 202 additions and 174 deletions

View File

@ -1,8 +1,8 @@
#!/usr/bin/env python3.2
#!/usr/bin/env python3.3
# -*- coding: utf-8 -*-
# Nemubot is a smart and modulable IM bot.
# Copyright (C) 2012-2014 Mercier Pierre-Olivier
# Copyright (C) 2012-2015 Mercier Pierre-Olivier
#
# 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
@ -23,11 +23,11 @@ import logging
import os
import sys
import bot
import prompt
from prompt.builtins import load_file
from prompt.reset import PromptReset
import importer
import nemubot
import nemubot.prompt as prompt
from nemubot.prompt.builtins import load_file
from nemubot.prompt.reset import PromptReset
from nemubot.importer import ModuleFinder
if __name__ == "__main__":
# Parse command line arguments
@ -59,7 +59,7 @@ if __name__ == "__main__":
args = parser.parse_args()
if args.version:
print(bot.__version__)
print(nemubot.__version__)
sys.exit(0)
# Setup loggin interface
@ -91,7 +91,7 @@ if __name__ == "__main__":
logger.error("%s is not a directory", path)
# Create bot context
context = bot.Bot(modules_paths=modules_paths, data_path=args.data_path,
context = nemubot.Bot(modules_paths=modules_paths, data_path=args.data_path,
verbosity=args.verbose)
if args.no_connect:
@ -101,7 +101,7 @@ if __name__ == "__main__":
prmpt = prompt.Prompt()
# Register the hook for futur import
sys.meta_path.append(importer.ModuleFinder(context, prmpt))
sys.meta_path.append(ModuleFinder(context, prmpt))
# Load requested configuration files
for path in args.files:
@ -114,7 +114,7 @@ if __name__ == "__main__":
for module in args.module:
__import__(module)
print ("Nemubot v%s ready, my PID is %i!" % (bot.__version__,
print ("Nemubot v%s ready, my PID is %i!" % (nemubot.__version__,
os.getpid()))
context.start()
while True:
@ -127,14 +127,14 @@ if __name__ == "__main__":
try:
# Reload context
imp.reload(bot)
context = bot.hotswap(context)
context = nemubot.hotswap(context)
# Reload prompt
imp.reload(prompt)
prmpt = prompt.hotswap(prmpt)
# Reload all other modules
bot.reload()
nemubot.reload()
print("\033[1;32mContext reloaded\033[0m, now in Nemubot %s" %
bot.__version__)
nemubot.__version__)
context.start()
except:
logger.exception("\033[1;31mUnable to reload the prompt due to "

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# Nemubot is a modulable IRC bot, built around XML configuration files.
# Copyright (C) 2012 Mercier Pierre-Olivier
# Nemubot is a smart and modulable IM bot.
# Copyright (C) 2012-2015 Mercier Pierre-Olivier
#
# 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
@ -27,16 +27,16 @@ import threading
import time
import uuid
__version__ = '3.4.dev4'
__version__ = '4.0.dev0'
__author__ = 'nemunaire'
from consumer import Consumer, EventConsumer, MessageConsumer
from event import ModuleEvent
from hooks.messagehook import MessageHook
from hooks.manager import HooksManager
from networkbot import NetworkBot
from nemubot.consumer import Consumer, EventConsumer, MessageConsumer
from nemubot.event import ModuleEvent
from nemubot.hooks.messagehook import MessageHook
from nemubot.hooks.manager import HooksManager
from nemubot.networkbot import NetworkBot
logger = logging.getLogger("nemubot.bot")
logger = logging.getLogger("nemubot")
class Bot(threading.Thread):
@ -129,7 +129,7 @@ class Bot(threading.Thread):
def run(self):
from server import _rlist, _wlist, _xlist
from nemubot.server import _rlist, _wlist, _xlist
self.stop = False
while not self.stop:
@ -453,44 +453,44 @@ def hotswap(bak):
return new
def reload():
import channel
imp.reload(channel)
import nemubot.channel
imp.reload(nemubot.channel)
import consumer
imp.reload(consumer)
import nemubot.consumer
imp.reload(nemubot.consumer)
import event
imp.reload(event)
import nemubot.event
imp.reload(nemubot.event)
import exception
imp.reload(exception)
import nemubot.exception
imp.reload(nemubot.exception)
import hooks
imp.reload(hooks)
import nemubot.hooks
imp.reload(nemubot.hooks)
hooks.reload()
nemubot.hooks.reload()
import importer
imp.reload(importer)
import nemubot.importer
imp.reload(nemubot.importer)
import message
imp.reload(message)
import nemubot.message
imp.reload(nemubot.message)
message.reload()
nemubot.message.reload()
import prompt
imp.reload(prompt)
import nemubot.prompt
imp.reload(nemubot.prompt)
prompt.reload()
nemubot.prompt.reload()
import server
rl, wl, xl = server._rlist, server._wlist, server._xlist
imp.reload(server)
server._rlist, server._wlist, server._xlist = rl, wl, xl
import nemubot.server
rl, wl, xl = nemubot.server._rlist, nemubot.server._wlist, nemubot.server._xlist
imp.reload(nemubot.server)
nemubot.server._rlist, nemubot.server._wlist, nemubot.server._xlist = rl, wl, xl
server.reload()
nemubot.server.reload()
import tools
imp.reload(tools)
import nemubot.tools
imp.reload(nemubot.tools)
tools.reload()
nemubot.tools.reload()

View File

@ -1,7 +1,7 @@
# coding=utf-8
# Nemubot is a modulable IRC bot, built around XML configuration files.
# Copyright (C) 2012 Mercier Pierre-Olivier
# Nemubot is a smart and modulable IM bot.
# Copyright (C) 2012-2015 Mercier Pierre-Olivier
#
# 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

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# Nemubot is a modulable IRC bot, built around XML configuration files.
# Copyright (C) 2012 Mercier Pierre-Olivier
# Nemubot is a smart and modulable IM bot.
# Copyright (C) 2012-2015 Mercier Pierre-Olivier
#
# 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

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# 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
# it under the terms of the GNU Affero General Public License as published by
@ -18,6 +18,7 @@
from datetime import datetime, timedelta, timezone
class ModuleEvent:
"""Representation of a event initiated by a bot module"""
@ -71,7 +72,6 @@ class ModuleEvent:
# How many times do this event?
self.times = times
@property
def current(self):
"""Return the date of the near check"""
@ -81,7 +81,6 @@ class ModuleEvent:
return self._end
return None
@property
def next(self):
"""Return the date of the next check"""
@ -93,7 +92,6 @@ class ModuleEvent:
return self._end
return None
@property
def time_left(self):
"""Return the time left before/after the near check"""
@ -101,7 +99,6 @@ class ModuleEvent:
return self.current - datetime.now(timezone.utc)
return 99999 # TODO: 99999 is not a valid time to return
def check(self):
"""Run a check and realized the event if this is time"""

View File

@ -1,7 +1,7 @@
# coding=utf-8
# Nemubot is a modulable IRC bot, built around XML configuration files.
# Copyright (C) 2012 Mercier Pierre-Olivier
# Nemubot is a smart and modulable IM bot.
# Copyright (C) 2012-2015 Mercier Pierre-Olivier
#
# 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
@ -16,7 +16,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from message import TextMessage, DirectAsk
from nemubot.message import TextMessage, DirectAsk
class IRCException(Exception):

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# 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
# it under the terms of the GNU Affero General Public License as published by
@ -18,7 +18,7 @@
import imp
from exception import IRCException
from nemubot.exception import IRCException
def call_game(call, *args, **kargs):
@ -67,7 +67,7 @@ class AbstractHook:
return ret
from hooks.messagehook import MessageHook
from nemubot.hooks.messagehook import MessageHook
last_registered = []
@ -81,8 +81,8 @@ def hook(store, *args, **kargs):
def reload():
import hooks.manager
imp.reload(hooks.manager)
import nemubot.hooks.manager
imp.reload(nemubot.hooks.manager)
import hooks.messagehook
imp.reload(hooks.messagehook)
import nemubot.hooks.messagehook
imp.reload(nemubot.hooks.messagehook)

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# 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
# it under the terms of the GNU Affero General Public License as published by

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# 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
# it under the terms of the GNU Affero General Public License as published by
@ -18,19 +18,19 @@
import re
from exception import IRCException
import hooks
import message
from nemubot.exception import IRCException
from nemubot.hooks import AbstractHook
import nemubot.message
class MessageHook(hooks.AbstractHook):
class MessageHook(AbstractHook):
"""Class storing hook information, specialized for a generic Message"""
def __init__(self, call, name=None, data=None, regexp=None,
channels=list(), server=None, mtimes=-1, end_call=None):
hooks.AbstractHook.__init__(self, call=call, data=data,
AbstractHook.__init__(self, call=call, data=data,
end_call=end_call, mtimes=mtimes)
self.name = name
@ -40,12 +40,12 @@ class MessageHook(hooks.AbstractHook):
def match(self, msg, server=None):
if not isinstance(msg, message.AbstractMessage):
if not isinstance(msg, nemubot.message.AbstractMessage):
return True
elif isinstance(msg, message.Command):
elif isinstance(msg, nemubot.message.Command):
return self.is_matching(msg.cmd, msg.to, server)
elif isinstance(msg, message.TextMessage):
elif isinstance(msg, nemubot.message.TextMessage):
return self.is_matching(msg.message, msg.to, server)
else:
return False

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# Nemubot is a modulable IRC bot, built around XML configuration files.
# Copyright (C) 2012 Mercier Pierre-Olivier
# Nemubot is a smart and modulable IM bot.
# Copyright (C) 2012-2015 Mercier Pierre-Olivier
#
# 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
@ -24,16 +24,18 @@ import logging
import os
import sys
from bot import __version__
import event
import exception
import hooks
from message import TextMessage
from tools.xmlparser import parse_file, module_state
from nemubot import __version__
from nemubot.event import ModuleEvent
from nemubot.exception import IRCException
import nemubot.hooks
from nemubot.message import TextMessage
from nemubot.tools.xmlparser import parse_file, module_state
logger = logging.getLogger("nemubot.importer")
class ModuleFinder(Finder):
def __init__(self, context, prompt):
self.context = context
self.prompt = prompt
@ -151,9 +153,9 @@ class ModuleLoader(SourceFileLoader):
module.save = lambda: False
module.CONF = self.config
module.ModuleEvent = event.ModuleEvent
module.ModuleEvent = ModuleEvent
module.ModuleState = module_state.ModuleState
module.IRCException = exception.IRCException
module.IRCException = IRCException
# Load dependancies
if module.CONF is not None and module.CONF.hasNode("dependson"):
@ -213,7 +215,7 @@ def register_hooks(module, context, prompt):
"""
# Register decorated functions
for s, h in hooks.last_registered:
for s, h in nemubot.hooks.last_registered:
if s == "prompt_cmd":
prompt.add_cap_hook(h.name, h.call)
elif s == "prompt_list":
@ -222,4 +224,4 @@ def register_hooks(module, context, prompt):
s = convert_legacy_store(s)
module.REGISTERED_HOOKS.append((s, h))
context.hooks.add_hook(h, s)
hooks.last_registered = []
nemubot.hooks.last_registered = []

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# 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
# it under the terms of the GNU Affero General Public License as published by
@ -166,10 +166,10 @@ class OwnerCommand(Command):
def reload():
import message.visitor
imp.reload(message.visitor)
import nemubot.message.visitor
imp.reload(nemubot.message.visitor)
import message.printer
imp.reload(message.printer)
import nemubot.message.printer
imp.reload(nemubot.message.printer)
message.printer.reload()
nemubot.message.printer.reload()

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# 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
# it under the terms of the GNU Affero General Public License as published by
@ -16,8 +16,8 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from message import TextMessage
from message.visitor import AbstractVisitor
from nemubot.message import TextMessage
from nemubot.message.visitor import AbstractVisitor
class IRC(AbstractVisitor):

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# 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
# it under the terms of the GNU Affero General Public License as published by
@ -20,5 +20,5 @@ import imp
def reload():
import message.printer.IRC
imp.reload(message.printer.IRC)
import nemubot.message.printer.IRC
imp.reload(nemubot.message.printer.IRC)

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# 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
# it under the terms of the GNU Affero General Public License as published by

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# Nemubot is a modulable IRC bot, built around XML configuration files.
# Copyright (C) 2012 Mercier Pierre-Olivier
# Nemubot is a smart and modulable IM bot.
# Copyright (C) 2012-2015 Mercier Pierre-Olivier
#
# 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
@ -22,8 +22,8 @@ import shlex
import urllib.parse
import zlib
from server.DCC import DCC
import hooks
from nemubot.server.DCC import DCC
import nemubot.hooks as hooks
class NetworkBot:
def __init__(self, context, srv, dest, dcc=None):

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# Nemubot is a modulable IRC bot, built around XML configuration files.
# Copyright (C) 2012 Mercier Pierre-Olivier
# Nemubot is a smart and modulable IM bot.
# Copyright (C) 2012-2015 Mercier Pierre-Olivier
#
# 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
@ -23,9 +23,9 @@ import shlex
import sys
import traceback
from .error import PromptError
from .reset import PromptReset
from . import builtins
from nemubot.prompt.error import PromptError
from nemubot.prompt.reset import PromptReset
from nemubot.prompt import builtins
class Prompt:
@ -134,5 +134,11 @@ def hotswap(bak):
def reload():
import prompt.builtins
imp.reload(prompt.builtins)
import nemubot.prompt.builtins
imp.reload(nemubot.prompt.builtins)
import nemubot.prompt.error
imp.reload(nemubot.prompt.error)
import nemubot.prompt.reset
imp.reload(nemubot.prompt.reset)

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# Nemubot is a modulable IRC bot, built around XML configuration files.
# Copyright (C) 2012 Mercier Pierre-Olivier
# Nemubot is a smart and modulable IM bot.
# Copyright (C) 2012-2015 Mercier Pierre-Olivier
#
# 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
@ -18,8 +18,8 @@
import logging
from .reset import PromptReset
from tools.config import load_file
from nemubot.prompt.reset import PromptReset
from nemubot.tools.config import load_file
logger = logging.getLogger("nemubot.prompt.builtins")

View File

@ -1,7 +1,7 @@
# coding=utf-8
# Nemubot is a modulable IRC bot, built around XML configuration files.
# Copyright (C) 2012 Mercier Pierre-Olivier
# Nemubot is a smart and modulable IM bot.
# Copyright (C) 2012-2015 Mercier Pierre-Olivier
#
# 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

View File

@ -1,7 +1,7 @@
# coding=utf-8
# Nemubot is a modulable IRC bot, built around XML configuration files.
# Copyright (C) 2012 Mercier Pierre-Olivier
# Nemubot is a smart and modulable IM bot.
# Copyright (C) 2012-2015 Mercier Pierre-Olivier
#
# 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

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# Nemubot is a modulable IRC bot, built around XML configuration files.
# Copyright (C) 2012 Mercier Pierre-Olivier
# Nemubot is a smart and modulable IM bot.
# Copyright (C) 2012-2015 Mercier Pierre-Olivier
#
# 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
@ -25,8 +25,8 @@ import time
import threading
import traceback
import message
import server
import nemubot.message as message
import nemubot.server as server
#Store all used ports
PORTS = list()

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# 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
# it under the terms of the GNU Affero General Public License as published by
@ -23,10 +23,10 @@ import re
import time
import shlex
from channel import Channel
import message
from message.printer.IRC import IRC as IRCPrinter
from server.socket import SocketServer
from nemubot.channel import Channel
import nemubot.message as message
from nemubot.message.printer.IRC import IRC as IRCPrinter
from nemubot.server.socket import SocketServer
class IRC(SocketServer):
@ -97,18 +97,18 @@ class IRC(SocketServer):
self.logger.error("DCC: unable to connect to %s:%d", ip, port)
return "ERRMSG unable to connect to %s:%d" % (ip, port)
import bot
import nemubot
self.ctcp_capabilities["ACTION"] = lambda msg, cmds: print ("ACTION receive: %s" % cmds)
self.ctcp_capabilities["CLIENTINFO"] = _ctcp_clientinfo
#self.ctcp_capabilities["DCC"] = _ctcp_dcc
self.ctcp_capabilities["FINGER"] = lambda msg, cmds: "VERSION nemubot v%s" % bot.__version__
self.ctcp_capabilities["NEMUBOT"] = lambda msg, cmds: "NEMUBOT %s" % bot.__version__
self.ctcp_capabilities["FINGER"] = lambda msg, cmds: "VERSION nemubot v%s" % nemubot.__version__
self.ctcp_capabilities["NEMUBOT"] = lambda msg, cmds: "NEMUBOT %s" % nemubot.__version__
self.ctcp_capabilities["PING"] = lambda msg, cmds: "PING %s" % " ".join(cmds[1:])
self.ctcp_capabilities["SOURCE"] = lambda msg, cmds: "SOURCE https://github.com/nemunaire/nemubot"
self.ctcp_capabilities["TIME"] = lambda msg, cmds: "TIME %s" % (datetime.now())
self.ctcp_capabilities["USERINFO"] = lambda msg, cmds: "USERINFO %s" % self.realname
self.ctcp_capabilities["VERSION"] = lambda msg, cmds: "VERSION nemubot v%s" % bot.__version__
self.ctcp_capabilities["VERSION"] = lambda msg, cmds: "VERSION nemubot v%s" % nemubot.__version__
# TODO: Temporary fix, waiting for hook based CTCP management
self.ctcp_capabilities["TYPING"] = lambda msg, cmds: None

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# 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
# it under the terms of the GNU Affero General Public License as published by
@ -154,8 +154,8 @@ class AbstractServer(io.IOBase):
def reload():
import server.socket
imp.reload(server.socket)
import nemubot.server.socket
imp.reload(nemubot.server.socket)
import server.IRC
imp.reload(server.IRC)
import nemubot.server.IRC
imp.reload(nemubot.server.IRC)

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# 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
# it under the terms of the GNU Affero General Public License as published by
@ -19,7 +19,7 @@
import ssl
import socket
from server import AbstractServer
from nemubot.server import AbstractServer
class SocketServer(AbstractServer):

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# 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
# it under the terms of the GNU Affero General Public License as published by
@ -20,16 +20,22 @@ import imp
def reload():
import tools.countdown
imp.reload(tools.countdown)
import nemubot.tools.config
imp.reload(nemubot.tools.config)
import tools.date
imp.reload(tools.date)
import nemubot.tools.countdown
imp.reload(nemubot.tools.countdown)
import tools.web
imp.reload(tools.web)
import nemubot.tools.date
imp.reload(nemubot.tools.date)
import tools.xmlparser
imp.reload(tools.xmlparser)
import tools.xmlparser.node
imp.reload(tools.xmlparser.node)
import nemubot.tools.human
imp.reload(nemubot.tools.human)
import nemubot.tools.web
imp.reload(nemubot.tools.web)
import nemubot.tools.xmlparser
imp.reload(nemubot.tools.xmlparser)
import nemubot.tools.xmlparser.node
imp.reload(nemubot.tools.xmlparser.node)

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# Nemubot is a modulable IRC bot, built around XML configuration files.
# Copyright (C) 2012 Mercier Pierre-Olivier
# Nemubot is a smart and modulable IM bot.
# Copyright (C) 2012-2015 Mercier Pierre-Olivier
#
# 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
@ -19,7 +19,7 @@
import logging
import os
from tools.xmlparser import parse_file
from nemubot.tools.xmlparser import parse_file
logger = logging.getLogger("nemubot.tools.config")
@ -80,7 +80,7 @@ def _load_server(config, xmlnode):
# Bind the protocol asked to the corresponding implementation
if "protocol" not in xmlnode or xmlnode["protocol"] == "irc":
from server.IRC import IRC as IRCServer
from nemubot.server.IRC import IRC as IRCServer
srvcls = IRCServer
else:
raise Exception("Unhandled protocol '%s'" %

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# 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
# it under the terms of the GNU Affero General Public License as published by

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# 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
# it under the terms of the GNU Affero General Public License as published by

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# Nemubot is a modulable IRC bot, built around XML configuration files.
# Copyright (C) 2012 Mercier Pierre-Olivier
# Nemubot is a smart and modulable IM bot.
# Copyright (C) 2012-2015 Mercier Pierre-Olivier
#
# 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

View File

@ -1,7 +1,7 @@
# coding=utf-8
# Nemubot is a modulable IRC bot, built around XML configuration files.
# Copyright (C) 2012 Mercier Pierre-Olivier
# Nemubot is a smart and modulable IM bot.
# Copyright (C) 2012-2015 Mercier Pierre-Olivier
#
# 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
@ -25,9 +25,9 @@ from urllib.parse import quote
from urllib.parse import urlparse
from urllib.request import urlopen
from bot import __version__
from exception import IRCException
from tools.xmlparser import parse_string
from nemubot import __version__
from nemubot.exception import IRCException
from nemubot.tools.xmlparser import parse_string
def isURL(url):

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# Nemubot is a modulable IRC bot, built around XML configuration files.
# Copyright (C) 2012 Mercier Pierre-Olivier
# Nemubot is a smart and modulable IM bot.
# Copyright (C) 2012-2015 Mercier Pierre-Olivier
#
# 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
@ -19,12 +19,13 @@
import logging
import xml.sax
from . import node as module_state
from nemubot.tools.xmlparser import node as module_state
logger = logging.getLogger("nemubot.tools.xmlparser")
class ModuleStatesFile(xml.sax.ContentHandler):
def startDocument(self):
self.root = None
self.stack = list()

View File

@ -1,5 +1,21 @@
# coding=utf-8
# Nemubot is a smart and modulable IM bot.
# Copyright (C) 2012-2015 Mercier Pierre-Olivier
#
# 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
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import xml.sax
from datetime import datetime, timezone
import logging