1
0
Fork 0

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
*.py[cod]
__pycache__
build/
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
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 traceback
import bot
import prompt
from prompt.builtins import load_file
import importer
from nemubot import Bot
from nemubot import prompt
from nemubot.prompt.builtins import load_file
from nemubot import importer
if __name__ == "__main__":
# Create bot context
context = bot.Bot(0, "FIXME")
context = Bot(0, "FIXME")
# Load the prompt
prmpt = prompt.Prompt()

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-2014 nemunaire
#
# 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
from nemubot import server
#Store all used ports
PORTS = list()

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

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

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

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-2014 nemunaire
#
# 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-2014 nemunaire
#
# 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 response import Response
from nemubot.response import Response
class IRCException(Exception):

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

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

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

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

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-2014 nemunaire
#
# 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
@ -165,7 +165,7 @@ class Response:
self.elt = 0
return msg
import hooks
import nemubot.hooks
class Hook:
def __init__(self, TYPE, call, name=None, data=None, regexp=None,
channels=list(), server=None, end=None, call_end=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-2014 nemunaire
#
# 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-2014 nemunaire
#
# 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-2014 nemunaire
#
# 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-2014 nemunaire
#
# 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-2014 nemunaire
#
# 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,9 +19,9 @@
import traceback
import sys
from networkbot import NetworkBot
from nemubot.networkbot import NetworkBot
nemubotversion = 3.3
nemubotversion = 4.0
NODATA = True
def getserver(toks, context, prompt):