Introducing nemubot v4 directories architecture

This commit is contained in:
nemunaire 2014-07-17 14:45:31 +02:00
parent fabdbc7c47
commit 35ae6b6245
26 changed files with 102 additions and 86 deletions

2
.gitignore vendored
View File

@ -3,4 +3,6 @@
TAGS TAGS
*.py[cod] *.py[cod]
__pycache__ __pycache__
build/
datas/ datas/
dist/

View File

@ -1,7 +1,21 @@
# *nemubot* # nemubot
An extremely modulable IRC bot, built around XML configuration files! A smart and modulable IM bot!
## Usage
TODO
## Documentation ## Documentation
Have a look to the wiki at https://github.com/nemunaire/nemubot/wiki Have a look to the wiki at https://github.com/nemunaire/nemubot/wiki
## Building
TODO
## License
This software is copyright (c) 2014 by nemunaire.
This is free software; you can redistribute it and/or modify it under the same terms as GNU Affero General Public Licence v3.

View File

@ -22,14 +22,14 @@ import os
import imp import imp
import traceback import traceback
import bot from nemubot import Bot
import prompt from nemubot import prompt
from prompt.builtins import load_file from nemubot.prompt.builtins import load_file
import importer from nemubot import importer
if __name__ == "__main__": if __name__ == "__main__":
# Create bot context # Create bot context
context = bot.Bot(0, "FIXME") context = Bot(0, "FIXME")
# Load the prompt # Load the prompt
prmpt = prompt.Prompt() prmpt = prompt.Prompt()

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-2014 nemunaire
# #
# 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
@ -25,8 +25,8 @@ import time
import threading import threading
import traceback import traceback
import message import nemubot.message
import server from nemubot import server
#Store all used ports #Store all used ports
PORTS = list() PORTS = list()

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-2014 nemunaire
# #
# 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
@ -23,12 +23,12 @@ import socket
import threading import threading
import traceback import traceback
from channel import Channel from nemubot.channel import Channel
from DCC import DCC from nemubot.DCC import DCC
from hooks import Hook from nemubot.hooks import Hook
import message import nemubot.message
import server from nemubot import server
import xmlparser import nemubot.xmlparser
class IRCServer(server.Server): class IRCServer(server.Server):
"""Class to interact with an IRC server""" """Class to interact with an IRC server"""

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-2014 nemunaire
# #
# 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
@ -23,21 +23,21 @@ import threading
import time import time
import re import re
import consumer from nemubot import consumer
import event from nemubot import event
import hooks from nemubot import hooks
from networkbot import NetworkBot from nemubot.networkbot import NetworkBot
from IRCServer import IRCServer from nemubot.IRCServer import IRCServer
from DCC import DCC from nemubot.DCC import DCC
import response from nemubot import response
ID_letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" ID_letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
class Bot: class Bot:
def __init__(self, ip, realname, mp=list()): def __init__(self, ip, realname, mp=list()):
# Bot general informations # Bot general informations
self.version = 3.3 self.version = 4.0
self.version_txt = "3.3" self.version_txt = '4.0.dev0'
# Save various informations # Save various informations
self.ip = ip self.ip = ip

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-2014 nemunaire
# #
# 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

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-2014 nemunaire
# #
# 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
@ -22,11 +22,10 @@ import threading
import traceback import traceback
import sys import sys
import bot from nemubot.DCC import DCC
from DCC import DCC from nemubot.message import Message
from message import Message from nemubot import response
import response from nemubot import server
import server
class MessageConsumer: class MessageConsumer:
"""Store a message before treating""" """Store a message before treating"""

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-2014 nemunaire
# #
# 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

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-2014 nemunaire
# #
# 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
@ -16,7 +16,7 @@
# You should have received a copy of the GNU Affero General Public License # 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/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from response import Response from nemubot.response import Response
class IRCException(Exception): class IRCException(Exception):

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-2014 nemunaire
# #
# 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
@ -18,8 +18,8 @@
import re import re
from response import Response from nemubot.response import Response
from exception import IRCException from nemubot.exception import IRCException
class MessagesHook: class MessagesHook:
def __init__(self, context, bot): def __init__(self, context, bot):

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-2014 nemunaire
# #
# 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
@ -22,11 +22,11 @@ import imp
import os import os
import sys import sys
import event from nemubot import event
import exception from nemubot import exception
from hooks import Hook from nemubot.hooks import Hook
import response from nemubot import response
import xmlparser from nemubot import xmlparser
class ModuleFinder(Finder): class ModuleFinder(Finder):
def __init__(self, context, prompt): def __init__(self, context, prompt):

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-2014 nemunaire
# #
# 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
@ -21,10 +21,10 @@ import re
import shlex import shlex
import time import time
import credits import nemubot.credits
from credits import Credits from nemubot.credits import Credits
from response import Response from nemubot.response import Response
import xmlparser import nemubot.xmlparser
CREDITS = {} CREDITS = {}
filename = "" filename = ""

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-2014 nemunaire
# #
# 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
@ -22,9 +22,9 @@ import shlex
import urllib.parse import urllib.parse
import zlib import zlib
from DCC import DCC from nemubot.DCC import DCC
import hooks import nemubot.hooks
from response import Response from nemubot.response import Response
class NetworkBot: class NetworkBot:
def __init__(self, context, srv, dest, dcc=None): def __init__(self, context, srv, dest, dcc=None):

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-2014 nemunaire
# #
# 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

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-2014 nemunaire
# #
# 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
@ -17,7 +17,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
import os import os
import xmlparser
from nemubot import xmlparser
def end(toks, context, prompt): def end(toks, context, prompt):
"""Quit the prompt for reload or exit""" """Quit the prompt for reload or exit"""

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-2014 nemunaire
# #
# 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
@ -165,7 +165,7 @@ class Response:
self.elt = 0 self.elt = 0
return msg return msg
import hooks import nemubot.hooks
class Hook: class Hook:
def __init__(self, TYPE, call, name=None, data=None, regexp=None, def __init__(self, TYPE, call, name=None, data=None, regexp=None,
channels=list(), server=None, end=None, call_end=None, channels=list(), server=None, end=None, call_end=None,

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-2014 nemunaire
# #
# 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

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-2014 nemunaire
# #
# 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

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-2014 nemunaire
# #
# 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

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-2014 nemunaire
# #
# 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

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-2014 nemunaire
# #
# 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,9 +19,9 @@
import traceback import traceback
import sys import sys
from networkbot import NetworkBot from nemubot.networkbot import NetworkBot
nemubotversion = 3.3 nemubotversion = 4.0
NODATA = True NODATA = True
def getserver(toks, context, prompt): def getserver(toks, context, prompt):