mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-30 14:14:37 +01:00
w00, less path mungingEXCLAIMEXCLAIM
This commit is contained in:
parent
5c3f13bd51
commit
f9c61271ea
@ -23,10 +23,10 @@
|
||||
# distributed in the hope that it will be useful, but WITTHOUT ANY WARRANTY.
|
||||
#*****************************************************************************
|
||||
|
||||
import re, copy, sys, os.path
|
||||
import registry
|
||||
import conf
|
||||
import StringIO
|
||||
import re, copy, sys, os.path, StringIO
|
||||
|
||||
import supybot.conf as conf
|
||||
import supybot.registry as registry
|
||||
|
||||
#*****************************************************************************
|
||||
#
|
||||
|
@ -36,19 +36,19 @@ Allows aliases for other commands.
|
||||
__revision__ = "$Id$"
|
||||
__author__ = 'Jeremy Fincher (jemfinch) <jemfinch@users.sf.net>'
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import os
|
||||
import re
|
||||
import sets
|
||||
|
||||
import conf
|
||||
import utils
|
||||
import privmsgs
|
||||
import registry
|
||||
import callbacks
|
||||
import structures
|
||||
import unpreserve
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.registry as registry
|
||||
import supybot.callbacks as callbacks
|
||||
import supybot.structures as structures
|
||||
import supybot.unpreserve as unpreserve
|
||||
|
||||
class AliasError(Exception):
|
||||
pass
|
||||
|
@ -37,17 +37,17 @@ __revision__ = "$Id$"
|
||||
__author__ = "James Vega (jamessan) <jamessan@users.sf.net>"
|
||||
|
||||
import getopt
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import amazon
|
||||
|
||||
import registry
|
||||
import supybot.registry as registry
|
||||
|
||||
import conf
|
||||
import utils
|
||||
import ircutils
|
||||
import privmsgs
|
||||
import callbacks
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
|
||||
def configure(advanced):
|
||||
|
@ -35,15 +35,15 @@ Allows folks to talk through the bot anonymously.
|
||||
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import conf
|
||||
import utils
|
||||
import ircdb
|
||||
import ircmsgs
|
||||
import privmsgs
|
||||
import registry
|
||||
import callbacks
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.ircdb as ircdb
|
||||
import supybot.ircmsgs as ircmsgs
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.registry as registry
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
|
||||
def configure(advanced):
|
||||
|
@ -42,11 +42,11 @@ from itertools import imap
|
||||
|
||||
import babelfish
|
||||
|
||||
import conf
|
||||
import utils
|
||||
import privmsgs
|
||||
import registry
|
||||
import callbacks
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.registry as registry
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
class Languages(registry.OnlySomeStrings):
|
||||
validStrings = tuple(map(str.capitalize, babelfish.available_languages))
|
||||
|
@ -36,21 +36,21 @@ to say bad words.
|
||||
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import re
|
||||
import math
|
||||
import sets
|
||||
import time
|
||||
|
||||
import conf
|
||||
import utils
|
||||
import ircdb
|
||||
import ircmsgs
|
||||
import ircutils
|
||||
import privmsgs
|
||||
import registry
|
||||
import callbacks
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.ircdb as ircdb
|
||||
import supybot.ircmsgs as ircmsgs
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.registry as registry
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
def configure(advanced):
|
||||
from questions import output, expect, anything, something, yn
|
||||
|
@ -46,16 +46,16 @@ import xml.dom.minidom as minidom
|
||||
from itertools import imap, ifilter
|
||||
from htmlentitydefs import entitydefs as entities
|
||||
|
||||
import registry
|
||||
import supybot.registry as registry
|
||||
|
||||
import conf
|
||||
import utils
|
||||
import plugins
|
||||
import ircutils
|
||||
import privmsgs
|
||||
import webutils
|
||||
import callbacks
|
||||
import structures
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.plugins as plugins
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.webutils as webutils
|
||||
import supybot.callbacks as callbacks
|
||||
import supybot.structures as structures
|
||||
|
||||
statusKeys = ['unconfirmed', 'new', 'assigned', 'reopened', 'resolved',
|
||||
'verified', 'closed']
|
||||
|
@ -36,19 +36,19 @@ Logs each channel to its own individual logfile.
|
||||
__revision__ = "$Id$"
|
||||
__author__ = 'Jeremy Fincher (jemfinch) <jemfinch@users.sf.net>'
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import time
|
||||
from cStringIO import StringIO
|
||||
|
||||
import os
|
||||
import conf
|
||||
import world
|
||||
import irclib
|
||||
import ircmsgs
|
||||
import ircutils
|
||||
import registry
|
||||
import callbacks
|
||||
import supybot.conf as conf
|
||||
import supybot.world as world
|
||||
import supybot.irclib as irclib
|
||||
import supybot.ircmsgs as ircmsgs
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.registry as registry
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
conf.registerPlugin('ChannelLogger')
|
||||
conf.registerGlobalValue(conf.supybot.plugins.ChannelLogger,
|
||||
|
@ -38,17 +38,17 @@ between channels on different networks, check out the Relay plugin.
|
||||
__revision__ = "$Id$"
|
||||
__author__ = 'Jeremy Fincher (jemfinch) <jemfinch@users.sf.net>'
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import re
|
||||
|
||||
import conf
|
||||
import utils
|
||||
import irclib
|
||||
import ircmsgs
|
||||
import privmsgs
|
||||
import registry
|
||||
import callbacks
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.irclib as irclib
|
||||
import supybot.ircmsgs as ircmsgs
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.registry as registry
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
class ValidChannelOrNothing(conf.ValidChannel):
|
||||
"""Value must be either a valid IRC channel or the empty string."""
|
||||
|
@ -37,7 +37,7 @@ statistics about smileys, actions, characters, and words.
|
||||
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import os
|
||||
import re
|
||||
@ -47,18 +47,18 @@ import getopt
|
||||
import string
|
||||
from itertools import imap, ifilter
|
||||
|
||||
import log
|
||||
import conf
|
||||
import utils
|
||||
import world
|
||||
import ircdb
|
||||
import irclib
|
||||
import ircmsgs
|
||||
import plugins
|
||||
import ircutils
|
||||
import privmsgs
|
||||
import registry
|
||||
import callbacks
|
||||
import supybot.log as log
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.world as world
|
||||
import supybot.ircdb as ircdb
|
||||
import supybot.irclib as irclib
|
||||
import supybot.ircmsgs as ircmsgs
|
||||
import supybot.plugins as plugins
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.registry as registry
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
class Smileys(registry.Value):
|
||||
def set(self, s):
|
||||
|
@ -36,7 +36,7 @@ and FINGER.
|
||||
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import os
|
||||
import sys
|
||||
@ -44,9 +44,9 @@ import time
|
||||
|
||||
sys.path.append(os.pardir)
|
||||
|
||||
import conf
|
||||
import ircmsgs
|
||||
import callbacks
|
||||
import supybot.conf as conf
|
||||
import supybot.ircmsgs as ircmsgs
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
notice = ircmsgs.notice
|
||||
|
||||
|
@ -39,13 +39,13 @@ __author__ = ''
|
||||
|
||||
import re
|
||||
|
||||
import conf
|
||||
import utils
|
||||
import ircutils
|
||||
import privmsgs
|
||||
import registry
|
||||
import webutils
|
||||
import callbacks
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.registry as registry
|
||||
import supybot.webutils as webutils
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
class CurrencyCommand(registry.String):
|
||||
def setValue(self, s):
|
||||
|
@ -35,19 +35,19 @@ Supports various DCC things.
|
||||
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import socket
|
||||
import textwrap
|
||||
import threading
|
||||
|
||||
import conf
|
||||
import utils
|
||||
import world
|
||||
import ircmsgs
|
||||
import ircutils
|
||||
import privmsgs
|
||||
import callbacks
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.world as world
|
||||
import supybot.ircmsgs as ircmsgs
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
class DCC(callbacks.Privmsg):
|
||||
def chat(self, irc, msg, args):
|
||||
|
@ -36,7 +36,7 @@ This is a module to contain Debian-specific commands.
|
||||
__revision__ = "$Id$"
|
||||
__author__ = "James Vega (jamessan) <jamessan@users.sf.net>"
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import re
|
||||
import gzip
|
||||
@ -49,13 +49,13 @@ import fnmatch
|
||||
import os.path
|
||||
from itertools import imap, ifilter
|
||||
|
||||
import registry
|
||||
import supybot.registry as registry
|
||||
|
||||
import conf
|
||||
import utils
|
||||
import privmsgs
|
||||
import webutils
|
||||
import callbacks
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.webutils as webutils
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
|
||||
def configure(advanced):
|
||||
|
@ -35,7 +35,7 @@ Commands that use the dictd protocol to snag stuff off a server.
|
||||
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import sets
|
||||
import random
|
||||
@ -43,13 +43,13 @@ import socket
|
||||
|
||||
import dictclient
|
||||
|
||||
import conf
|
||||
import utils
|
||||
import plugins
|
||||
import registry
|
||||
import ircutils
|
||||
import privmsgs
|
||||
import callbacks
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.plugins as plugins
|
||||
import supybot.registry as registry
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
|
||||
def configure(advanced):
|
||||
|
@ -41,12 +41,12 @@ __author__ = "Daniel DiPaolo (Strike) <ddipaolo@users.sf.net>"
|
||||
import os
|
||||
import time
|
||||
|
||||
import conf
|
||||
import utils
|
||||
import ircdb
|
||||
import plugins
|
||||
import privmsgs
|
||||
import callbacks
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.ircdb as ircdb
|
||||
import supybot.plugins as plugins
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
try:
|
||||
import sqlite
|
||||
|
@ -40,14 +40,14 @@ import getopt
|
||||
__revision__ = "$Id$"
|
||||
__author__ = "James Vega (jamessan) <jamessan@users.sf.net>"
|
||||
|
||||
import conf
|
||||
import utils
|
||||
import plugins
|
||||
import ircutils
|
||||
import privmsgs
|
||||
import registry
|
||||
import webutils
|
||||
import callbacks
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.plugins as plugins
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.registry as registry
|
||||
import supybot.webutils as webutils
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
|
||||
def configure(advanced):
|
||||
|
@ -39,16 +39,16 @@ empty channel in order to get ops.
|
||||
__revision__ = "$Id$"
|
||||
__author__ = 'Jeremy Fincher (jemfinch) <jemfinch@users.sf.net>'
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import conf
|
||||
import ircdb
|
||||
import ircmsgs
|
||||
import plugins
|
||||
import ircutils
|
||||
import privmsgs
|
||||
import registry
|
||||
import callbacks
|
||||
import supybot.conf as conf
|
||||
import supybot.ircdb as ircdb
|
||||
import supybot.ircmsgs as ircmsgs
|
||||
import supybot.plugins as plugins
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.registry as registry
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
def configure(advanced):
|
||||
from questions import output, expect, anything, something, yn
|
||||
|
@ -36,7 +36,7 @@ available on demand via several commands.
|
||||
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import time
|
||||
import getopt
|
||||
@ -44,15 +44,15 @@ import string
|
||||
import os.path
|
||||
from itertools import imap
|
||||
|
||||
import conf
|
||||
import utils
|
||||
import ircdb
|
||||
import ircutils
|
||||
import privmsgs
|
||||
import registry
|
||||
import callbacks
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.ircdb as ircdb
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.registry as registry
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
import Owner
|
||||
import supybot.Owner as Owner
|
||||
|
||||
try:
|
||||
import sqlite
|
||||
|
@ -36,19 +36,19 @@ the output of the bot.
|
||||
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import re
|
||||
import string
|
||||
import random
|
||||
import itertools
|
||||
|
||||
import conf
|
||||
import utils
|
||||
import ircmsgs
|
||||
import ircutils
|
||||
import privmsgs
|
||||
import callbacks
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.ircmsgs as ircmsgs
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
class MyFilterProxy(object):
|
||||
def reply(self, s):
|
||||
|
@ -36,14 +36,14 @@ to access the bot.
|
||||
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import re
|
||||
import random
|
||||
|
||||
import irclib
|
||||
import ircmsgs
|
||||
import ircutils
|
||||
import supybot.irclib as irclib
|
||||
import supybot.ircmsgs as ircmsgs
|
||||
import supybot.ircutils as ircutils
|
||||
|
||||
class FixRelayBot(irclib.IrcCallback):
|
||||
_re = re.compile(r'<([^@]+)@[^>]+>\s+(.*)')
|
||||
|
@ -36,15 +36,15 @@ Provides simple commands for formatting text on IRC.
|
||||
__revision__ = "$Id$"
|
||||
__author__ = 'Jeremy Fincher (jemfinch) <jemfinch@users.sf.net>'
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import string
|
||||
|
||||
import conf
|
||||
import utils
|
||||
import ircutils
|
||||
import privmsgs
|
||||
import callbacks
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
|
||||
def configure(advanced):
|
||||
|
@ -37,10 +37,10 @@ __revision__ = "$Id$"
|
||||
|
||||
deprecated = True
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import ircutils
|
||||
import callbacks
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
class Friendly(callbacks.PrivmsgRegexp):
|
||||
onlyFirstMatch = True
|
||||
|
@ -35,7 +35,7 @@ Provides a multitude of fun, useless commands.
|
||||
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import gc
|
||||
import re
|
||||
@ -48,12 +48,12 @@ import inspect
|
||||
import mimetypes
|
||||
from itertools import imap
|
||||
|
||||
import conf
|
||||
import utils
|
||||
import ircmsgs
|
||||
import ircutils
|
||||
import privmsgs
|
||||
import callbacks
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.ircmsgs as ircmsgs
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
class MyFunProxy(object):
|
||||
def reply(self, msg, s):
|
||||
|
@ -35,7 +35,7 @@ Provides fun commands that require a database to operate.
|
||||
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import re
|
||||
import sets
|
||||
@ -45,16 +45,16 @@ import string
|
||||
import os.path
|
||||
from itertools import imap
|
||||
|
||||
import registry
|
||||
import supybot.registry as registry
|
||||
|
||||
import conf
|
||||
import ircdb
|
||||
import utils
|
||||
import world
|
||||
import ircmsgs
|
||||
import ircutils
|
||||
import privmsgs
|
||||
import callbacks
|
||||
import supybot.conf as conf
|
||||
import supybot.ircdb as ircdb
|
||||
import supybot.utils as utils
|
||||
import supybot.world as world
|
||||
import supybot.ircmsgs as ircmsgs
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
try:
|
||||
import sqlite
|
||||
|
@ -35,20 +35,20 @@ Handles URL snarfing for Gameknot.com and the gkstats command.
|
||||
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import re
|
||||
import sets
|
||||
import urllib2
|
||||
|
||||
import registry
|
||||
import supybot.registry as registry
|
||||
|
||||
import conf
|
||||
import utils
|
||||
import plugins
|
||||
import ircutils
|
||||
import privmsgs
|
||||
import callbacks
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.plugins as plugins
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
|
||||
def configure(advanced):
|
||||
|
@ -35,7 +35,7 @@ Acceses Google for various things.
|
||||
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import re
|
||||
import sets
|
||||
@ -48,16 +48,16 @@ import xml.sax
|
||||
import SOAP
|
||||
import google
|
||||
|
||||
import registry
|
||||
import supybot.registry as registry
|
||||
|
||||
import conf
|
||||
import utils
|
||||
import ircmsgs
|
||||
import plugins
|
||||
import ircutils
|
||||
import privmsgs
|
||||
import callbacks
|
||||
import structures
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.ircmsgs as ircmsgs
|
||||
import supybot.plugins as plugins
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.callbacks as callbacks
|
||||
import supybot.structures as structures
|
||||
|
||||
def configure(advanced):
|
||||
from questions import output, expect, anything, something, yn
|
||||
|
@ -40,17 +40,17 @@ import os
|
||||
import time
|
||||
import getopt
|
||||
|
||||
import log
|
||||
import conf
|
||||
import utils
|
||||
import world
|
||||
import ircdb
|
||||
import ircmsgs
|
||||
import plugins
|
||||
import ircutils
|
||||
import privmsgs
|
||||
import registry
|
||||
import callbacks
|
||||
import supybot.log as log
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.world as world
|
||||
import supybot.ircdb as ircdb
|
||||
import supybot.ircmsgs as ircmsgs
|
||||
import supybot.plugins as plugins
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.registry as registry
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
filename = os.path.join(conf.supybot.directories.data(), 'Herald.db')
|
||||
|
||||
|
@ -35,7 +35,7 @@ Provides several commands that go out to websites and get things.
|
||||
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import re
|
||||
import sets
|
||||
@ -46,12 +46,12 @@ import urllib2
|
||||
import xml.dom.minidom
|
||||
from itertools import imap, ifilter
|
||||
|
||||
import conf
|
||||
import utils
|
||||
import webutils
|
||||
import privmsgs
|
||||
import registry
|
||||
import callbacks
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.webutils as webutils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.registry as registry
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
class FreshmeatException(Exception):
|
||||
pass
|
||||
|
@ -36,20 +36,20 @@ Infobot compatibility, for the parts that we don't support already.
|
||||
__revision__ = "$Id$"
|
||||
__author__ = 'Jeremy Fincher (jemfinch) <jemfinch@users.sf.net>'
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import os
|
||||
import re
|
||||
import random
|
||||
import cPickle as pickle
|
||||
|
||||
import conf
|
||||
import utils
|
||||
import ircmsgs
|
||||
import ircutils
|
||||
import privmsgs
|
||||
import registry
|
||||
import callbacks
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.ircmsgs as ircmsgs
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.registry as registry
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
conf.registerPlugin('Infobot')
|
||||
conf.registerGlobalValue(conf.supybot.plugins.Infobot, 'personality',
|
||||
|
@ -39,12 +39,12 @@ import os
|
||||
import sets
|
||||
from itertools import imap
|
||||
|
||||
import conf
|
||||
import utils
|
||||
import plugins
|
||||
import privmsgs
|
||||
import registry
|
||||
import callbacks
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.plugins as plugins
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.registry as registry
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
try:
|
||||
import sqlite
|
||||
|
@ -35,12 +35,12 @@ Removes all bold output by the bot.
|
||||
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import re
|
||||
|
||||
import ircmsgs
|
||||
import callbacks
|
||||
import supybot.ircmsgs as ircmsgs
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
|
||||
# For some stupid reason, this doesn't work.
|
||||
|
@ -36,22 +36,22 @@ Allows for sending the bot's logging output to channels or users.
|
||||
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import logging
|
||||
import os.path
|
||||
from itertools import imap
|
||||
|
||||
import log
|
||||
import conf
|
||||
import utils
|
||||
import world
|
||||
import ircdb
|
||||
import ircmsgs
|
||||
import ircutils
|
||||
import privmsgs
|
||||
import registry
|
||||
import callbacks
|
||||
import supybot.log as log
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.world as world
|
||||
import supybot.ircdb as ircdb
|
||||
import supybot.ircmsgs as ircmsgs
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.registry as registry
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
|
||||
class IrcHandler(logging.Handler):
|
||||
|
@ -35,7 +35,7 @@ The Lookup plugin handles looking up various values by their key.
|
||||
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import os
|
||||
import re
|
||||
@ -44,11 +44,11 @@ import sets
|
||||
import getopt
|
||||
import string
|
||||
|
||||
import conf
|
||||
import utils
|
||||
import privmsgs
|
||||
import registry
|
||||
import callbacks
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.registry as registry
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
try:
|
||||
import sqlite
|
||||
|
@ -38,14 +38,14 @@ large enough, you can have it make fun little random messages from it.
|
||||
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import os.path
|
||||
|
||||
import ircmsgs
|
||||
import ircutils
|
||||
import privmsgs
|
||||
import callbacks
|
||||
import supybot.ircmsgs as ircmsgs
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
try:
|
||||
import sqlite
|
||||
|
@ -37,7 +37,7 @@ __revision__ = "$Id$"
|
||||
|
||||
from __future__ import division
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import re
|
||||
import math
|
||||
@ -46,9 +46,9 @@ import types
|
||||
import string
|
||||
from itertools import imap
|
||||
|
||||
import utils
|
||||
import privmsgs
|
||||
import callbacks
|
||||
import supybot.utils as utils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
import convertcore
|
||||
|
||||
|
@ -39,7 +39,7 @@ and if nothing is found, responds with an entry from the "dunno" database.
|
||||
__revision__="$Id$"
|
||||
__author__ = "Daniel DiPaolo (Strike) <ddipaolo@users.sf.net>"
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import os
|
||||
import sets
|
||||
@ -50,17 +50,17 @@ import random
|
||||
from itertools import imap
|
||||
from cStringIO import StringIO
|
||||
|
||||
import registry
|
||||
import supybot.registry as registry
|
||||
|
||||
import conf
|
||||
import ircdb
|
||||
import utils
|
||||
import ircmsgs
|
||||
import ircutils
|
||||
import privmsgs
|
||||
import callbacks
|
||||
import supybot.conf as conf
|
||||
import supybot.ircdb as ircdb
|
||||
import supybot.utils as utils
|
||||
import supybot.ircmsgs as ircmsgs
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
import Owner
|
||||
import supybot.Owner as Owner
|
||||
|
||||
try:
|
||||
import sqlite
|
||||
|
@ -35,16 +35,16 @@ Various network-related commands.
|
||||
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import sets
|
||||
import socket
|
||||
import telnetlib
|
||||
|
||||
import utils
|
||||
import ircutils
|
||||
import privmsgs
|
||||
import callbacks
|
||||
import supybot.utils as utils
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
|
||||
class Network(callbacks.Privmsg):
|
||||
|
@ -36,16 +36,16 @@ when they join the channel. News items may have expiration dates.
|
||||
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import os
|
||||
import time
|
||||
|
||||
import conf
|
||||
import ircdb
|
||||
import utils
|
||||
import privmsgs
|
||||
import callbacks
|
||||
import supybot.conf as conf
|
||||
import supybot.ircdb as ircdb
|
||||
import supybot.utils as utils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
try:
|
||||
import sqlite
|
||||
|
@ -55,16 +55,16 @@ an IRC nick is. It's an elitist hacker thing, but quite fun.
|
||||
__revision__ = '$Id$'
|
||||
__author__ = 'William Robinson (baggins) <airbaggins@users.sf.net>'
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import re
|
||||
import math
|
||||
import string
|
||||
|
||||
import conf
|
||||
import utils
|
||||
import privmsgs
|
||||
import callbacks
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
|
||||
def slowExponent(x):
|
||||
|
@ -36,7 +36,7 @@ users that can be retrieved later.
|
||||
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import sets
|
||||
import time
|
||||
@ -44,15 +44,15 @@ import getopt
|
||||
import os.path
|
||||
from itertools import imap
|
||||
|
||||
import conf
|
||||
import utils
|
||||
import ircdb
|
||||
import ircmsgs
|
||||
import plugins
|
||||
import privmsgs
|
||||
import registry
|
||||
import ircutils
|
||||
import callbacks
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.ircdb as ircdb
|
||||
import supybot.ircmsgs as ircmsgs
|
||||
import supybot.plugins as plugins
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.registry as registry
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
try:
|
||||
import sqlite
|
||||
|
@ -36,13 +36,13 @@ Commands specific to OSU;
|
||||
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import urllib2
|
||||
|
||||
import utils
|
||||
import privmsgs
|
||||
import callbacks
|
||||
import supybot.utils as utils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
|
||||
buildings = {
|
||||
|
@ -38,16 +38,16 @@ as he joins.
|
||||
|
||||
import sets
|
||||
|
||||
import conf
|
||||
import utils
|
||||
import ircdb
|
||||
import ircmsgs
|
||||
import ircutils
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.ircdb as ircdb
|
||||
import supybot.ircmsgs as ircmsgs
|
||||
import supybot.ircutils as ircutils
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import plugins
|
||||
import privmsgs
|
||||
import callbacks
|
||||
import supybot.plugins as plugins
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
def configure(advanced):
|
||||
from questions import output, something, yn
|
||||
|
@ -36,17 +36,17 @@ A module for managing and voting on polls.
|
||||
|
||||
__revision__ = "$Id$"
|
||||
__author__ = "Daniel DiPaolo (Strike) <ddipaolo@users.sf.net>"
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import os
|
||||
import time
|
||||
|
||||
import conf
|
||||
import utils
|
||||
import ircdb
|
||||
import ircutils
|
||||
import privmsgs
|
||||
import callbacks
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.ircdb as ircdb
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
try:
|
||||
import sqlite
|
||||
|
@ -36,7 +36,7 @@ written in) somehow.
|
||||
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import os
|
||||
import re
|
||||
@ -54,13 +54,13 @@ try:
|
||||
finally:
|
||||
sys.stdout = sys.__stdout__
|
||||
|
||||
import conf
|
||||
import utils
|
||||
import webutils
|
||||
import ircutils
|
||||
import privmsgs
|
||||
import registry
|
||||
import callbacks
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.webutils as webutils
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.registry as registry
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
L = [os.__file__]
|
||||
if hasattr(math, '__file__'):
|
||||
|
@ -39,23 +39,23 @@ as see who "grabbed" the quote in the first place.
|
||||
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import os
|
||||
import time
|
||||
import random
|
||||
|
||||
import registry # goes before conf! yell at jamessan, not me
|
||||
import supybot.registry as registry # goes before conf! yell at jamessan, not me
|
||||
|
||||
import conf
|
||||
import ircdb
|
||||
import utils
|
||||
import ircmsgs
|
||||
import plugins
|
||||
import ircutils
|
||||
import privmsgs
|
||||
import registry
|
||||
import callbacks
|
||||
import supybot.conf as conf
|
||||
import supybot.ircdb as ircdb
|
||||
import supybot.utils as utils
|
||||
import supybot.ircmsgs as ircmsgs
|
||||
import supybot.plugins as plugins
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.registry as registry
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
try:
|
||||
import sqlite
|
||||
|
@ -35,18 +35,18 @@ Maintains a Quotes database for each channel.
|
||||
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import re
|
||||
import time
|
||||
import getopt
|
||||
import os.path
|
||||
|
||||
import conf
|
||||
import utils
|
||||
import ircdb
|
||||
import privmsgs
|
||||
import callbacks
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.ircdb as ircdb
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
try:
|
||||
import sqlite
|
||||
|
@ -35,7 +35,7 @@ Provides basic functionality for handling RSS/RDF feeds.
|
||||
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import sets
|
||||
import time
|
||||
@ -46,14 +46,14 @@ from itertools import imap
|
||||
|
||||
import rssparser
|
||||
|
||||
import conf
|
||||
import utils
|
||||
import world
|
||||
import ircmsgs
|
||||
import ircutils
|
||||
import privmsgs
|
||||
import registry
|
||||
import callbacks
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.world as world
|
||||
import supybot.ircmsgs as ircmsgs
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.registry as registry
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
def configure(advanced):
|
||||
from questions import output, expect, anything, something, yn
|
||||
|
@ -35,12 +35,12 @@ Logs raw IRC messages to a file.
|
||||
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import os
|
||||
import conf
|
||||
import world
|
||||
import irclib
|
||||
import supybot.conf as conf
|
||||
import supybot.world as world
|
||||
import supybot.irclib as irclib
|
||||
|
||||
###
|
||||
# RawLogger: Logs the *raw* IRC messages.
|
||||
|
@ -36,7 +36,7 @@ Handles relaying between networks.
|
||||
__revision__ = "$Id$"
|
||||
__author__ = 'Jeremy Fincher (jemfinch) <jemfinch@users.sf.net>'
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import re
|
||||
import sys
|
||||
@ -44,16 +44,16 @@ import copy
|
||||
import time
|
||||
from itertools import imap, ifilter
|
||||
|
||||
import conf
|
||||
import utils
|
||||
import world
|
||||
import irclib
|
||||
import drivers
|
||||
import ircmsgs
|
||||
import ircutils
|
||||
import privmsgs
|
||||
import registry
|
||||
import callbacks
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.world as world
|
||||
import supybot.irclib as irclib
|
||||
import supybot.drivers as drivers
|
||||
import supybot.ircmsgs as ircmsgs
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.registry as registry
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
def configure(advanced):
|
||||
from questions import output, expect, anything, something, yn
|
||||
|
@ -35,13 +35,13 @@ Warns (or even kicks) people when they join a channel if their ident is root.
|
||||
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import conf
|
||||
import ircmsgs
|
||||
import ircutils
|
||||
import registry
|
||||
import callbacks
|
||||
import supybot.conf as conf
|
||||
import supybot.ircmsgs as ircmsgs
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.registry as registry
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
|
||||
conf.registerPlugin('RootWarner')
|
||||
|
@ -37,16 +37,16 @@ or repeatedly run at a particular interval.
|
||||
__revision__ = "$Id$"
|
||||
__author__ = 'Jeremy Fincher (jemfinch) <jemfinch@users.sf.net>'
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import sets
|
||||
import time
|
||||
|
||||
import conf
|
||||
import utils
|
||||
import privmsgs
|
||||
import schedule
|
||||
import callbacks
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.schedule as schedule
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
|
||||
class Scheduler(callbacks.Privmsg):
|
||||
|
@ -35,7 +35,7 @@ Keeps track of the last time a user was seen on a channel.
|
||||
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import os
|
||||
import re
|
||||
@ -45,17 +45,17 @@ import getopt
|
||||
import string
|
||||
from itertools import imap, ifilter
|
||||
|
||||
import log
|
||||
import conf
|
||||
import utils
|
||||
import world
|
||||
import ircdb
|
||||
import ircmsgs
|
||||
import plugins
|
||||
import ircutils
|
||||
import privmsgs
|
||||
import registry
|
||||
import callbacks
|
||||
import supybot.log as log
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.world as world
|
||||
import supybot.ircdb as ircdb
|
||||
import supybot.ircmsgs as ircmsgs
|
||||
import supybot.plugins as plugins
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.registry as registry
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
def ircToLowerOrInt(x):
|
||||
if isinstance(x, int):
|
||||
|
@ -35,18 +35,18 @@ Services: Handles management of nicks with NickServ, and ops with ChanServ.
|
||||
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import re
|
||||
import time
|
||||
|
||||
import conf
|
||||
import ircmsgs
|
||||
import privmsgs
|
||||
import ircutils
|
||||
import registry
|
||||
import schedule
|
||||
import callbacks
|
||||
import supybot.conf as conf
|
||||
import supybot.ircmsgs as ircmsgs
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.registry as registry
|
||||
import supybot.schedule as schedule
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
def configure(advanced):
|
||||
from questions import output, expect, anything, something, yn
|
||||
|
@ -42,17 +42,17 @@ import getopt
|
||||
|
||||
from itertools import ifilter, imap
|
||||
|
||||
import registry
|
||||
import supybot.registry as registry
|
||||
|
||||
import conf
|
||||
import utils
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
|
||||
import plugins
|
||||
import ircutils
|
||||
import privmsgs
|
||||
import registry
|
||||
import webutils
|
||||
import callbacks
|
||||
import supybot.plugins as plugins
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.registry as registry
|
||||
import supybot.webutils as webutils
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
|
||||
def configure(advanced):
|
||||
|
@ -35,7 +35,7 @@ current status and statistics.
|
||||
"""
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import os
|
||||
import sys
|
||||
@ -44,11 +44,11 @@ import time
|
||||
import threading
|
||||
from itertools import islice, ifilter, imap
|
||||
|
||||
import conf
|
||||
import utils
|
||||
import world
|
||||
import privmsgs
|
||||
import callbacks
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.world as world
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
|
||||
class Status(callbacks.Privmsg):
|
||||
|
@ -36,7 +36,7 @@ tasks to do, with an optional priority for each.
|
||||
|
||||
__revision__ = "$Id$"
|
||||
__author__ = "Daniel DiPaolo (Strike) <ddipaolo@users.sf.net>"
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import glob
|
||||
import time
|
||||
@ -44,11 +44,11 @@ import getopt
|
||||
import string
|
||||
import os.path
|
||||
|
||||
import conf
|
||||
import ircdb
|
||||
import utils
|
||||
import privmsgs
|
||||
import callbacks
|
||||
import supybot.conf as conf
|
||||
import supybot.ircdb as ircdb
|
||||
import supybot.utils as utils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
try:
|
||||
import sqlite
|
||||
|
@ -36,20 +36,20 @@ Provides commands for manipulating channel topics.
|
||||
__revision__ = "$Id$"
|
||||
__author__ = 'Jeremy Fincher (jemfinch) <jemfinch@users.sf.net>'
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import re
|
||||
import random
|
||||
|
||||
import conf
|
||||
import utils
|
||||
import ircdb
|
||||
import ircmsgs
|
||||
import plugins
|
||||
import ircutils
|
||||
import privmsgs
|
||||
import registry
|
||||
import callbacks
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.ircdb as ircdb
|
||||
import supybot.ircmsgs as ircmsgs
|
||||
import supybot.plugins as plugins
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.registry as registry
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
conf.registerPlugin('Topic')
|
||||
conf.registerChannelValue(conf.supybot.plugins.Topic, 'separator',
|
||||
|
@ -37,7 +37,7 @@ URLs in the database.
|
||||
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import os
|
||||
import re
|
||||
@ -46,14 +46,14 @@ import getopt
|
||||
import urllib2
|
||||
import urlparse
|
||||
|
||||
import conf
|
||||
import utils
|
||||
import ircmsgs
|
||||
import webutils
|
||||
import ircutils
|
||||
import privmsgs
|
||||
import registry
|
||||
import callbacks
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.ircmsgs as ircmsgs
|
||||
import supybot.webutils as webutils
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.registry as registry
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
try:
|
||||
import sqlite
|
||||
|
@ -35,7 +35,7 @@ Provides commands available only on Unix.
|
||||
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import os
|
||||
import re
|
||||
@ -50,10 +50,10 @@ import string
|
||||
import struct
|
||||
|
||||
|
||||
import conf
|
||||
import utils
|
||||
import privmsgs
|
||||
import callbacks
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
def configure(advanced):
|
||||
from questions import output, expect, anything, something, yn
|
||||
|
@ -36,14 +36,14 @@ Maintains various arbitrary information on users.
|
||||
__revision__ = "$Id$"
|
||||
__author__ = 'Jeremy Fincher (jemfinch) <jemfinch@users.sf.net>'
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import conf
|
||||
import utils
|
||||
import ircdb
|
||||
import privmsgs
|
||||
import registry
|
||||
import callbacks
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.ircdb as ircdb
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.registry as registry
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
conf.registerPlugin('UserInfo')
|
||||
conf.registerUserValue(conf.users, 'name',
|
||||
|
@ -36,15 +36,15 @@ Various utility commands, mostly useful for manipulating nested commands.
|
||||
__revision__ = "$Id$"
|
||||
__author__ = 'Jeremy Fincher (jemfinch) <jemfinch@users.sf.net>'
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import string
|
||||
|
||||
import utils
|
||||
import ircmsgs
|
||||
import ircutils
|
||||
import privmsgs
|
||||
import callbacks
|
||||
import supybot.utils as utils
|
||||
import supybot.ircmsgs as ircmsgs
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
class Utilities(callbacks.Privmsg):
|
||||
def ignore(self, irc, msg, args):
|
||||
|
@ -36,19 +36,19 @@ so don't get your hopes up. We just report it.
|
||||
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import re
|
||||
import sets
|
||||
import urllib
|
||||
|
||||
import conf
|
||||
import utils
|
||||
import webutils
|
||||
import ircutils
|
||||
import privmsgs
|
||||
import registry
|
||||
import callbacks
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.webutils as webutils
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.registry as registry
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
unitAbbrevs = utils.abbrev(['Fahrenheit', 'Celsius', 'Centigrade', 'Kelvin'])
|
||||
unitAbbrevs['C'] = 'Celsius'
|
||||
|
@ -39,16 +39,16 @@ import os
|
||||
import csv
|
||||
import string
|
||||
|
||||
import log
|
||||
import conf
|
||||
import utils
|
||||
import world
|
||||
import ircdb
|
||||
import plugins
|
||||
import ircutils
|
||||
import privmsgs
|
||||
import registry
|
||||
import callbacks
|
||||
import supybot.log as log
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.world as world
|
||||
import supybot.ircdb as ircdb
|
||||
import supybot.plugins as plugins
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.registry as registry
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
conf.registerPlugin('WordStats')
|
||||
conf.registerChannelValue(conf.supybot.plugins.WordStats, 'rankingDisplay',
|
||||
|
@ -36,7 +36,7 @@ This handles interesting things to do with a dictionary (words) database.
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import supybot
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import os
|
||||
import copy
|
||||
@ -46,12 +46,12 @@ import random
|
||||
|
||||
import sqlite
|
||||
|
||||
import conf
|
||||
import utils
|
||||
import privmsgs
|
||||
import callbacks
|
||||
import ircutils
|
||||
import registry
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.callbacks as callbacks
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.registry as registry
|
||||
|
||||
|
||||
class WordsDB(plugins.DBHandler):
|
||||
|
@ -36,17 +36,17 @@ Logs all the messages the bot receives to XML.
|
||||
__revision__ = "$Id$"
|
||||
__author__ = 'Jeremy Fincher (jemfinch) <jemfinch@users.sf.net>'
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import os.path
|
||||
|
||||
import conf
|
||||
import utils
|
||||
import world
|
||||
import ircmsgs
|
||||
import privmsgs
|
||||
import registry
|
||||
import callbacks
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.world as world
|
||||
import supybot.ircmsgs as ircmsgs
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.registry as registry
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
conf.registerPlugin('XMLLogger')
|
||||
conf.registerGlobalValue(conf.supybot.plugins.XMLLogger, 'prettyPrint',
|
||||
|
@ -0,0 +1,391 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
###
|
||||
# Copyright (c) 2002, Jeremiah Fincher
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions, and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions, and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the author of this software nor the name of
|
||||
# contributors to this software may be used to endorse or promote products
|
||||
# derived from this software without specific prior written consent.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
###
|
||||
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import supybot.fix as fix
|
||||
|
||||
import gc
|
||||
import os
|
||||
import re
|
||||
import csv
|
||||
import sys
|
||||
import sets
|
||||
import time
|
||||
import random
|
||||
import urllib2
|
||||
import UserDict
|
||||
import threading
|
||||
|
||||
import supybot.cdb as cdb
|
||||
import supybot.log as log
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.world as world
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.webutils as webutils
|
||||
|
||||
try:
|
||||
mxCrap = {}
|
||||
for (name, module) in sys.modules.items():
|
||||
if name.startswith('mx'):
|
||||
mxCrap[name] = module
|
||||
sys.modules[name] = None
|
||||
import sqlite
|
||||
for (name, module) in mxCrap.items():
|
||||
sys.modules[name] = module
|
||||
sqlite.have_datetime = False
|
||||
Connection = sqlite.Connection
|
||||
class MyConnection(sqlite.Connection):
|
||||
def commit(self, *args, **kwargs):
|
||||
if self.autocommit:
|
||||
return
|
||||
else:
|
||||
Connection.commit(self, *args, **kwargs)
|
||||
sqlite.Connection = MyConnection
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
class DBHandler(object):
|
||||
def __init__(self, name=None, suffix='.db'):
|
||||
if name is None:
|
||||
self.name = self.__class__.__name__
|
||||
else:
|
||||
self.name = name
|
||||
if suffix and suffix[0] != '.':
|
||||
suffix = '.' + suffix
|
||||
self.suffix = suffix
|
||||
self.cachedDb = None
|
||||
|
||||
def makeFilename(self):
|
||||
if self.name.endswith(self.suffix):
|
||||
return self.name
|
||||
else:
|
||||
return self.name + self.suffix
|
||||
|
||||
def makeDb(self, filename):
|
||||
raise NotImplementedError
|
||||
|
||||
def getDb(self):
|
||||
if self.cachedDb is None or \
|
||||
threading.currentThread() is not world.mainThread:
|
||||
db = self.makeDb(self.makeFilename())
|
||||
else:
|
||||
db = self.cachedDb
|
||||
db.autocommit = 1
|
||||
return db
|
||||
|
||||
def die(self):
|
||||
if self.cachedDb is not None:
|
||||
self.cachedDb.die()
|
||||
del self.cachedDb
|
||||
|
||||
|
||||
# XXX: This shouldn't be a mixin. This should be contained by classes that
|
||||
# want such behavior. But at this point, it wouldn't gain much for us
|
||||
# to refactor it.
|
||||
class ChannelDBHandler(object):
|
||||
"""A class to handle database stuff for individual channels transparently.
|
||||
"""
|
||||
suffix = '.db'
|
||||
def __init__(self, suffix='.db'):
|
||||
self.dbCache = ircutils.IrcDict()
|
||||
suffix = self.suffix
|
||||
if self.suffix and self.suffix[0] != '.':
|
||||
suffix = '.' + suffix
|
||||
self.suffix = suffix
|
||||
|
||||
def makeFilename(self, channel):
|
||||
"""Override this to specialize the filenames of your databases."""
|
||||
channel = ircutils.toLower(channel)
|
||||
prefix = '%s-%s%s' % (channel, self.__class__.__name__, self.suffix)
|
||||
return os.path.join(conf.supybot.directories.data(), prefix)
|
||||
|
||||
def makeDb(self, filename):
|
||||
"""Override this to create your databases."""
|
||||
return cdb.shelf(filename)
|
||||
|
||||
def getDb(self, channel):
|
||||
"""Use this to get a database for a specific channel."""
|
||||
currentThread = threading.currentThread()
|
||||
if channel not in self.dbCache and currentThread == world.mainThread:
|
||||
self.dbCache[channel] = self.makeDb(self.makeFilename(channel))
|
||||
if currentThread != world.mainThread:
|
||||
db = self.makeDb(self.makeFilename(channel))
|
||||
else:
|
||||
db = self.dbCache[channel]
|
||||
db.autocommit = 1
|
||||
return db
|
||||
|
||||
def die(self):
|
||||
for db in self.dbCache.itervalues():
|
||||
try:
|
||||
db.commit()
|
||||
except AttributeError: # In case it's not an SQLite database.
|
||||
pass
|
||||
try:
|
||||
db.close()
|
||||
except AttributeError: # In case it doesn't have a close method.
|
||||
pass
|
||||
del db
|
||||
gc.collect()
|
||||
|
||||
|
||||
class ChannelUserDictionary(UserDict.DictMixin):
|
||||
IdDict = dict
|
||||
def __init__(self):
|
||||
self.channels = ircutils.IrcDict()
|
||||
|
||||
def __getitem__(self, (channel, id)):
|
||||
return self.channels[channel][id]
|
||||
|
||||
def __setitem__(self, (channel, id), v):
|
||||
if channel not in self.channels:
|
||||
self.channels[channel] = self.IdDict()
|
||||
self.channels[channel][id] = v
|
||||
|
||||
def __delitem__(self, (channel, id)):
|
||||
del self.channels[channel][id]
|
||||
|
||||
def iteritems(self):
|
||||
for (channel, ids) in self.channels.iteritems():
|
||||
for (id, v) in ids.iteritems():
|
||||
yield ((channel, id), v)
|
||||
|
||||
def keys(self):
|
||||
L = []
|
||||
for (k, _) in self.iteritems():
|
||||
L.append(k)
|
||||
return L
|
||||
|
||||
|
||||
class ChannelUserDB(ChannelUserDictionary):
|
||||
def __init__(self, filename):
|
||||
ChannelUserDictionary.__init__(self)
|
||||
self.filename = filename
|
||||
try:
|
||||
fd = file(self.filename)
|
||||
except EnvironmentError, e:
|
||||
log.warning('Couldn\'t open %s: %s.', self.filename, e)
|
||||
return
|
||||
reader = csv.reader(fd)
|
||||
try:
|
||||
lineno = 0
|
||||
for t in reader:
|
||||
lineno += 1
|
||||
try:
|
||||
channel = t.pop(0)
|
||||
id = t.pop(0)
|
||||
try:
|
||||
id = int(id)
|
||||
except ValueError:
|
||||
# We'll skip over this so, say, nicks can be kept here.
|
||||
pass
|
||||
v = self.deserialize(channel, id, t)
|
||||
self[channel, id] = v
|
||||
except Exception, e:
|
||||
log.warning('Invalid line #%s in %s.',
|
||||
lineno, self.__class__.__name__)
|
||||
log.debug('Exception: %s', utils.exnToString(e))
|
||||
except Exception, e: # This catches exceptions from csv.reader.
|
||||
log.warning('Invalid line #%s in %s.',
|
||||
lineno, self.__class__.__name__)
|
||||
log.debug('Exception: %s', utils.exnToString(e))
|
||||
|
||||
def flush(self):
|
||||
fd = file(self.filename, 'w')
|
||||
writer = csv.writer(fd)
|
||||
items = self.items()
|
||||
items.sort()
|
||||
for ((channel, id), v) in items:
|
||||
L = self.serialize(v)
|
||||
L.insert(0, id)
|
||||
L.insert(0, channel)
|
||||
writer.writerow(L)
|
||||
fd.close()
|
||||
|
||||
def close(self):
|
||||
self.flush()
|
||||
self.clear()
|
||||
|
||||
def deserialize(self, channel, id, L):
|
||||
"""Should take a list of strings and return an object to be accessed
|
||||
via self.get(channel, id)."""
|
||||
raise NotImplementedError
|
||||
|
||||
def serialize(self, x):
|
||||
"""Should take an object (as returned by self.get(channel, id)) and
|
||||
return a list (of any type serializable to csv)."""
|
||||
raise NotImplementedError
|
||||
|
||||
class PeriodicFileDownloader(object):
|
||||
"""A class to periodically download a file/files.
|
||||
|
||||
A class-level dictionary 'periodicFiles' maps names of files to
|
||||
three-tuples of
|
||||
(url, seconds between downloads, function to run with downloaded file).
|
||||
|
||||
'url' should be in some form that urllib2.urlopen can handle (do note that
|
||||
urllib2.urlopen handles file:// links perfectly well.)
|
||||
|
||||
'seconds between downloads' is the number of seconds between downloads,
|
||||
obviously. An important point to remember, however, is that it is only
|
||||
engaged when a command is run. I.e., if you say you want the file
|
||||
downloaded every day, but no commands that use it are run in a week, the
|
||||
next time such a command is run, it'll be using a week-old file. If you
|
||||
don't want such behavior, you'll have to give an error mess age to the user
|
||||
and tell him to call you back in the morning.
|
||||
|
||||
'function to run with downloaded file' is a function that will be passed
|
||||
a string *filename* of the downloaded file. This will be some random
|
||||
filename probably generated via some mktemp-type-thing. You can do what
|
||||
you want with this; you may want to build a database, take some stats,
|
||||
or simply rename the file. You can pass None as your function and the
|
||||
file with automatically be renamed to match the filename you have it listed
|
||||
under. It'll be in conf.supybot.directories.data, of course.
|
||||
|
||||
Aside from that dictionary, simply use self.getFile(filename) in any method
|
||||
that makes use of a periodically downloaded file, and you'll be set.
|
||||
"""
|
||||
periodicFiles = None
|
||||
def __init__(self):
|
||||
if self.periodicFiles is None:
|
||||
raise ValueError, 'You must provide files to download'
|
||||
self.lastDownloaded = {}
|
||||
self.downloadedCounter = {}
|
||||
for filename in self.periodicFiles:
|
||||
if self.periodicFiles[filename][-1] is None:
|
||||
fullname = os.path.join(conf.supybot.directories.data(),
|
||||
filename)
|
||||
if os.path.exists(fullname):
|
||||
self.lastDownloaded[filename] = os.stat(fullname).st_ctime
|
||||
else:
|
||||
self.lastDownloaded[filename] = 0
|
||||
else:
|
||||
self.lastDownloaded[filename] = 0
|
||||
self.currentlyDownloading = sets.Set()
|
||||
self.downloadedCounter[filename] = 0
|
||||
self.getFile(filename)
|
||||
|
||||
def _downloadFile(self, filename, url, f):
|
||||
if world.documenting:
|
||||
return
|
||||
self.currentlyDownloading.add(filename)
|
||||
try:
|
||||
try:
|
||||
infd = webutils.getUrlFd(url)
|
||||
except IOError, e:
|
||||
self.log.warning('Error downloading %s: %s', url, e)
|
||||
return
|
||||
confDir = conf.supybot.directories.data()
|
||||
newFilename = os.path.join(confDir, utils.mktemp())
|
||||
outfd = file(newFilename, 'wb')
|
||||
start = time.time()
|
||||
s = infd.read(4096)
|
||||
while s:
|
||||
outfd.write(s)
|
||||
s = infd.read(4096)
|
||||
infd.close()
|
||||
outfd.close()
|
||||
self.log.info('Downloaded %s in %s seconds',
|
||||
filename, time.time()-start)
|
||||
self.downloadedCounter[filename] += 1
|
||||
self.lastDownloaded[filename] = time.time()
|
||||
if f is None:
|
||||
toFilename = os.path.join(confDir, filename)
|
||||
if os.name == 'nt':
|
||||
# Windows, grrr...
|
||||
if os.path.exists(toFilename):
|
||||
os.remove(toFilename)
|
||||
os.rename(newFilename, toFilename)
|
||||
else:
|
||||
start = time.time()
|
||||
f(newFilename)
|
||||
total = time.time() - start
|
||||
self.log.info('Function ran on %s in %s seconds',
|
||||
filename, total)
|
||||
finally:
|
||||
self.currentlyDownloading.remove(filename)
|
||||
|
||||
def getFile(self, filename):
|
||||
(url, timeLimit, f) = self.periodicFiles[filename]
|
||||
if time.time() - self.lastDownloaded[filename] > timeLimit and \
|
||||
filename not in self.currentlyDownloading:
|
||||
self.log.info('Beginning download of %s', url)
|
||||
args = (filename, url, f)
|
||||
name = '%s #%s' % (filename, self.downloadedCounter[filename])
|
||||
t = threading.Thread(target=self._downloadFile, name=name,
|
||||
args=(filename, url, f))
|
||||
t.setDaemon(True)
|
||||
t.start()
|
||||
world.threadsSpawned += 1
|
||||
|
||||
|
||||
_randomnickRe = re.compile(r'\$rand(?:om)?nick', re.I)
|
||||
_randomdateRe = re.compile(r'\$rand(?:om)?date', re.I)
|
||||
_randomintRe = re.compile(r'\$rand(?:omint)?', re.I)
|
||||
_channelRe = re.compile(r'\$channel', re.I)
|
||||
_whoRe = re.compile(r'\$(?:who|nick)', re.I)
|
||||
_botnickRe = re.compile(r'\$botnick', re.I)
|
||||
_todayRe = re.compile(r'\$(?:today|date)', re.I)
|
||||
_nowRe = re.compile(r'\$(?:now|time)', re.I)
|
||||
_userRe = re.compile(r'\$user', re.I)
|
||||
_hostRe = re.compile(r'\$host', re.I)
|
||||
def standardSubstitute(irc, msg, text):
|
||||
"""Do the standard set of substitutions on text, and return it"""
|
||||
if ircutils.isChannel(msg.args[0]):
|
||||
channel = msg.args[0]
|
||||
else:
|
||||
channel = 'somewhere'
|
||||
def randInt(m):
|
||||
return str(random.randint(-1000, 1000))
|
||||
def randDate(m):
|
||||
t = pow(2,30)*random.random()+time.time()/4.0
|
||||
return time.ctime(t)
|
||||
def randNick(m):
|
||||
if channel != 'somewhere':
|
||||
return random.choice(list(irc.state.channels[channel].users))
|
||||
else:
|
||||
return 'someone'
|
||||
text = _channelRe.sub(channel, text)
|
||||
text = _randomnickRe.sub(randNick, text)
|
||||
text = _randomdateRe.sub(randDate, text)
|
||||
text = _randomintRe.sub(randInt, text)
|
||||
text = _whoRe.sub(msg.nick, text)
|
||||
text = _botnickRe.sub(irc.nick, text)
|
||||
text = _todayRe.sub(time.ctime(), text)
|
||||
text = _nowRe.sub(time.ctime(), text)
|
||||
text = _userRe.sub(msg.user, text)
|
||||
text = _hostRe.sub(msg.host, text)
|
||||
return text
|
||||
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
@ -30,8 +30,8 @@
|
||||
###
|
||||
|
||||
"""
|
||||
Silently listens to a channel, building a database of Markov Chains for later
|
||||
hijinks. To read more about Markov Chains, check out
|
||||
Silently listens to a channel, building an SQL database of Markov Chains for
|
||||
later hijinks. To read more about Markov Chains, check out
|
||||
<http://www.cs.bell-labs.com/cm/cs/pearls/sec153.html>. When the database is
|
||||
large enough, you can have it make fun little random messages from it.
|
||||
"""
|
||||
@ -40,112 +40,109 @@ __revision__ = "$Id$"
|
||||
|
||||
import plugins
|
||||
|
||||
import anydbm
|
||||
import random
|
||||
import os.path
|
||||
|
||||
import conf
|
||||
import world
|
||||
import ircmsgs
|
||||
import ircutils
|
||||
import privmsgs
|
||||
import callbacks
|
||||
|
||||
try:
|
||||
import sqlite
|
||||
except ImportError:
|
||||
raise callbacks.Error, 'You need to have PySQLite installed to use this ' \
|
||||
'plugin. Download it at <http://pysqlite.sf.net/>'
|
||||
|
||||
class MarkovDB(object):
|
||||
def __init__(self):
|
||||
self.dbs = {}
|
||||
conf.registerPlugin('Markov')
|
||||
conf.registerGlobalValue(supybot.plugins.Markov, 'maximumWorkQueue',
|
||||
registry.PositiveInteger(10, """Determines what the maximum number of
|
||||
oustanding Markov work requests will be allowed."""))
|
||||
|
||||
def die(self):
|
||||
for db in self.dbs.values():
|
||||
try:
|
||||
db.close()
|
||||
except:
|
||||
continue
|
||||
class MarkovThread(threading.Thread):
|
||||
def __init__(self, high, low):
|
||||
self.q = q
|
||||
|
||||
def _getDb(self, channel):
|
||||
channel = channel.lower()
|
||||
if channel not in self.dbs:
|
||||
filename = '%s-Markov.db' % channel
|
||||
filename = os.path.join(conf.supybot.directories.data(), filename)
|
||||
self.dbs[channel] = anydbm.open(filename, 'c')
|
||||
return self.dbs[channel]
|
||||
|
||||
def __getitem__(self, (channel, item)):
|
||||
return self._getDb(channel)[item]
|
||||
|
||||
def __setitem__(self, (channel, item), value):
|
||||
self._getDb(channel)[item] = value
|
||||
|
||||
def getNumberOfPairs(self, channel):
|
||||
try:
|
||||
# Minus one, because we have a key storing the first pairs.
|
||||
return len(self[channel.lower()]) - 1
|
||||
except KeyError:
|
||||
return 0
|
||||
|
||||
def getNumberOfFirstPairs(self, channel):
|
||||
try:
|
||||
return len(self[channel, ''].split())
|
||||
except KeyError:
|
||||
return 0
|
||||
|
||||
def getFirstPair(self, channel):
|
||||
try:
|
||||
pairs = self[channel, ''].split()
|
||||
except KeyError:
|
||||
raise ValueError('No starting pairs in the database.')
|
||||
pair = random.choice(pairs)
|
||||
return pair.split('\x00', 1)
|
||||
|
||||
def getFollower(self, channel, first, second):
|
||||
pair = '%s %s' % (first, second)
|
||||
try:
|
||||
followers = self[channel, pair].split()
|
||||
except KeyError:
|
||||
return '\x00'
|
||||
return random.choice(followers)
|
||||
|
||||
def addFirstPair(self, channel, first, second):
|
||||
pair = '%s\x00%s' % (first, second)
|
||||
try:
|
||||
startingPairs = self[channel, '']
|
||||
except KeyError:
|
||||
startingPairs = ''
|
||||
self[channel, ''] = '%s%s ' % (startingPairs, pair)
|
||||
|
||||
def addPair(self, channel, first, second, follower):
|
||||
pair = '%s %s' % (first, second)
|
||||
try:
|
||||
followers = self[channel, pair]
|
||||
except KeyError:
|
||||
followers = ''
|
||||
self[channel, pair] = '%s%s ' % (followers, follower)
|
||||
def run(self):
|
||||
while 1:
|
||||
f = self.q.get()
|
||||
if f is None:
|
||||
break
|
||||
else:
|
||||
f()
|
||||
|
||||
|
||||
class Markov(callbacks.Privmsg):
|
||||
class Markov(plugins.ChannelDBHandler, callbacks.Privmsg):
|
||||
def __init__(self):
|
||||
callbacks.Privmsg.__init__(self)
|
||||
self.db = MarkovDB()
|
||||
plugins.ChannelDBHandler.__init__(self)
|
||||
self.q = Queue.Queue(self.registryValue('maximumWorkQueue'))
|
||||
self.t = MarkovThread(self.q)
|
||||
self.t.start()
|
||||
|
||||
def putq(self, f):
|
||||
try:
|
||||
self.q.put(f, False)
|
||||
except Queue.Full:
|
||||
self.log.info('Can\'t putq, queue full.')
|
||||
raise
|
||||
|
||||
def makeDb(self, filename):
|
||||
def f():
|
||||
if os.path.exists(filename):
|
||||
return sqlite.connect(filename)
|
||||
db = sqlite.connect(filename)
|
||||
cursor = db.cursor()
|
||||
cursor.execute("""CREATE TABLE pairs (
|
||||
id INTEGER PRIMARY KEY,
|
||||
first TEXT,
|
||||
second TEXT,
|
||||
is_first BOOLEAN,
|
||||
UNIQUE (first, second) ON CONFLICT IGNORE
|
||||
)""")
|
||||
cursor.execute("""CREATE TABLE follows (
|
||||
id INTEGER PRIMARY KEY,
|
||||
pair_id INTEGER,
|
||||
word TEXT
|
||||
)""")
|
||||
cursor.execute("""CREATE INDEX follows_pair_id
|
||||
ON follows (pair_id)""")
|
||||
db.commit()
|
||||
return db
|
||||
self.putq(f)
|
||||
|
||||
def doPrivmsg(self, irc, msg):
|
||||
if not ircutils.isChannel(msg.args[0]):
|
||||
return
|
||||
channel = msg.args[0]
|
||||
db = self.getDb(channel)
|
||||
cursor = db.cursor()
|
||||
if ircmsgs.isAction(msg):
|
||||
words = ircmsgs.unAction(msg).split()
|
||||
words.insert(0, '\x00nick')
|
||||
#words.insert(0, msg.nick)
|
||||
else:
|
||||
words = msg.args[1].split()
|
||||
isFirst = True
|
||||
for (first, second, follower) in window(words, 3):
|
||||
if isFirst:
|
||||
self.db.addFirstPair(channel, first, second)
|
||||
cursor.execute("""INSERT OR REPLACE
|
||||
INTO pairs VALUES (NULL, %s, %s, 1)""",
|
||||
first, second)
|
||||
isFirst = False
|
||||
self.db.addPair(channel, first, second, follower)
|
||||
else:
|
||||
cursor.execute("INSERT INTO pairs VALUES (NULL, %s, %s, 0)",
|
||||
first, second)
|
||||
cursor.execute("""SELECT id FROM pairs
|
||||
WHERE first=%s AND second=%s""", first, second)
|
||||
id = int(cursor.fetchone()[0])
|
||||
cursor.execute("""INSERT INTO follows VALUES (NULL, %s, %s)""",
|
||||
id, follower)
|
||||
if not isFirst: # i.e., if the loop iterated at all.
|
||||
self.db.addPair(channel, second, follower, '\x00')
|
||||
cursor.execute("""INSERT INTO pairs VALUES (NULL, %s, %s, 0)""",
|
||||
second, follower)
|
||||
cursor.execute("""SELECT id FROM pairs
|
||||
WHERE first=%s AND second=%s""", second,follower)
|
||||
id = int(cursor.fetchone()[0])
|
||||
cursor.execute("INSERT INTO follows VALUES (NULL, %s, NULL)", id)
|
||||
db.commit()
|
||||
|
||||
_maxMarkovLength = 80
|
||||
_minMarkovLength = 7
|
||||
@ -156,25 +153,40 @@ class Markov(callbacks.Privmsg):
|
||||
data kept on <channel> (which is only necessary if not sent in the
|
||||
channel itself).
|
||||
"""
|
||||
argsCopy = args[:]
|
||||
channel = privmsgs.getChannel(msg, args)
|
||||
try:
|
||||
pair = self.db.getFirstPair(channel)
|
||||
except ValueError:
|
||||
irc.error('I have no records for this channel.')
|
||||
db = self.getDb(channel)
|
||||
cursor = db.cursor()
|
||||
words = []
|
||||
cursor.execute("""SELECT id, first, second FROM pairs
|
||||
WHERE is_first=1
|
||||
ORDER BY random()
|
||||
LIMIT 1""")
|
||||
if cursor.rowcount == 0:
|
||||
irc.error('I have no records for that channel.')
|
||||
return
|
||||
words = [pair[0], pair[1]]
|
||||
(id, first, second) = cursor.fetchone()
|
||||
id = int(id)
|
||||
words.append(first)
|
||||
words.append(second)
|
||||
sql = """SELECT follows.word FROM pairs, follows
|
||||
WHERE pairs.first=%s AND
|
||||
pairs.second=%s AND
|
||||
pairs.id=follows.pair_id
|
||||
ORDER BY random()
|
||||
LIMIT 1"""
|
||||
while len(words) < self._maxMarkovLength:
|
||||
follower = self.db.getFollower(channel, words[-2], words[-1])
|
||||
if follower == '\x00':
|
||||
if len(words) < self._minMarkovLength:
|
||||
pair = self.db.getFirstPair(channel)
|
||||
words = [pair[0], pair[1]]
|
||||
else:
|
||||
cursor.execute(sql, words[-2], words[-1])
|
||||
results = cursor.fetchone()
|
||||
if not results:
|
||||
break
|
||||
word = results[0]
|
||||
if word is None:
|
||||
break
|
||||
words.append(word)
|
||||
if len(words) < self._minMarkovLength:
|
||||
self.markov(irc, msg, argsCopy)
|
||||
else:
|
||||
words.append(follower)
|
||||
if words[0] == '\x00nick':
|
||||
words[0] = choice(irc.state.channels[channel].users)
|
||||
irc.reply(' '.join(words))
|
||||
|
||||
def pairs(self, irc, msg, args):
|
||||
@ -184,7 +196,10 @@ class Markov(callbacks.Privmsg):
|
||||
<channel>.
|
||||
"""
|
||||
channel = privmsgs.getChannel(msg, args)
|
||||
n = self.db.getNumberOfPairs(channel)
|
||||
db = self.getDb(channel)
|
||||
cursor = db.cursor()
|
||||
cursor.execute("""SELECT COUNT(*) FROM pairs""")
|
||||
n = int(cursor.fetchone()[0])
|
||||
s = 'There are %s pairs in my Markov database for %s' % (n, channel)
|
||||
irc.reply(s)
|
||||
|
||||
@ -195,37 +210,40 @@ class Markov(callbacks.Privmsg):
|
||||
<channel>.
|
||||
"""
|
||||
channel = privmsgs.getChannel(msg, args)
|
||||
n = self.db.getNumberOfFirstPairs(channel)
|
||||
db = self.getDb(channel)
|
||||
cursor = db.cursor()
|
||||
cursor.execute("""SELECT COUNT(*) FROM pairs WHERE is_first=1""")
|
||||
n = int(cursor.fetchone()[0])
|
||||
s = 'There are %s first pairs in my Markov database for %s'%(n,channel)
|
||||
irc.reply(s)
|
||||
|
||||
# def follows(self, irc, msg, args):
|
||||
# """[<channel>]
|
||||
#
|
||||
# Returns the number of Markov's third links in the database for
|
||||
# <channel>.
|
||||
# """
|
||||
# channel = privmsgs.getChannel(msg, args)
|
||||
# db = self._getDb(channel)
|
||||
# cursor = db.cursor()
|
||||
# cursor.execute("""SELECT COUNT(*) FROM follows""")
|
||||
# n = int(cursor.fetchone()[0])
|
||||
# s = 'There are %s follows in my Markov database for %s' % (n, channel)
|
||||
# irc.reply(s)
|
||||
def follows(self, irc, msg, args):
|
||||
"""[<channel>]
|
||||
|
||||
# def lasts(self, irc, msg, args):
|
||||
# """[<channel>]
|
||||
#
|
||||
# Returns the number of Markov's last links in the database for
|
||||
# <channel>.
|
||||
# """
|
||||
# channel = privmsgs.getChannel(msg, args)
|
||||
# db = self._getDb(channel)
|
||||
# cursor = db.cursor()
|
||||
# cursor.execute("""SELECT COUNT(*) FROM follows WHERE word ISNULL""")
|
||||
# n = int(cursor.fetchone()[0])
|
||||
# s = 'There are %s lasts in my Markov database for %s' % (n, channel)
|
||||
# irc.reply(s)
|
||||
Returns the number of Markov's third links in the database for
|
||||
<channel>.
|
||||
"""
|
||||
channel = privmsgs.getChannel(msg, args)
|
||||
db = self.getDb(channel)
|
||||
cursor = db.cursor()
|
||||
cursor.execute("""SELECT COUNT(*) FROM follows""")
|
||||
n = int(cursor.fetchone()[0])
|
||||
s = 'There are %s follows in my Markov database for %s' % (n, channel)
|
||||
irc.reply(s)
|
||||
|
||||
def lasts(self, irc, msg, args):
|
||||
"""[<channel>]
|
||||
|
||||
Returns the number of Markov's last links in the database for
|
||||
<channel>.
|
||||
"""
|
||||
channel = privmsgs.getChannel(msg, args)
|
||||
db = self.getDb(channel)
|
||||
cursor = db.cursor()
|
||||
cursor.execute("""SELECT COUNT(*) FROM follows WHERE word ISNULL""")
|
||||
n = int(cursor.fetchone()[0])
|
||||
s = 'There are %s lasts in my Markov database for %s' % (n, channel)
|
||||
irc.reply(s)
|
||||
|
||||
|
||||
Class = Markov
|
||||
|
@ -58,14 +58,14 @@ import optparse
|
||||
started = time.time()
|
||||
|
||||
import supybot
|
||||
import registry
|
||||
import supybot.registry as registry
|
||||
|
||||
def main():
|
||||
import conf
|
||||
import utils
|
||||
import world
|
||||
import drivers
|
||||
import schedule
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.world as world
|
||||
import supybot.drivers as drivers
|
||||
import supybot.schedule as schedule
|
||||
# We schedule this event rather than have it actually run because if there
|
||||
# is a failure between now and the time it takes the Owner plugin to load
|
||||
# all the various plugins, our registry file might be wiped. That's bad.
|
||||
@ -184,9 +184,9 @@ if __name__ == '__main__':
|
||||
sys.stderr.write(os.linesep)
|
||||
sys.exit(-1)
|
||||
|
||||
import log
|
||||
import conf
|
||||
import world
|
||||
import supybot.log as log
|
||||
import supybot.conf as conf
|
||||
import supybot.world as world
|
||||
world.starting = True
|
||||
|
||||
def closeRegistry():
|
||||
@ -245,11 +245,11 @@ if __name__ == '__main__':
|
||||
fd.close()
|
||||
registry.open(userdataFilename)
|
||||
|
||||
import irclib
|
||||
import ircmsgs
|
||||
import drivers
|
||||
import callbacks
|
||||
import Owner
|
||||
import supybot.irclib as irclib
|
||||
import supybot.ircmsgs as ircmsgs
|
||||
import supybot.drivers as drivers
|
||||
import supybot.callbacks as callbacks
|
||||
import supybot.Owner as Owner
|
||||
|
||||
irc = irclib.Irc(nick, user=user, ident=ident,
|
||||
network=defaultNetwork, password=password)
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
import supybot
|
||||
|
||||
import fix
|
||||
import supybot.fix as fix
|
||||
from questions import *
|
||||
|
||||
import os
|
||||
@ -39,8 +39,8 @@ import sys
|
||||
import optparse
|
||||
|
||||
def main():
|
||||
import log
|
||||
import conf
|
||||
import supybot.log as log
|
||||
import supybot.conf as conf
|
||||
conf.supybot.log.stdout.setValue(False)
|
||||
#conf.supybot.log.level.set('DEBUG')
|
||||
|
||||
@ -72,7 +72,7 @@ def main():
|
||||
conf.supybot.directories.data.setValue('/')
|
||||
conf.supybot.directories.plugins.setValue(['/'])
|
||||
conf.supybot.databases.users.filename.setValue(filename)
|
||||
import ircdb
|
||||
import supybot.ircdb as ircdb
|
||||
|
||||
if not options.name:
|
||||
name = ''
|
||||
|
@ -11,7 +11,7 @@ if sys.version_info < (2, 3, 0):
|
||||
sys.stderr.write('This script requires Python 2.3 or newer.\n')
|
||||
sys.exit(-1)
|
||||
|
||||
import conf
|
||||
import supybot.conf as conf
|
||||
from questions import *
|
||||
|
||||
template = '''
|
||||
@ -53,12 +53,12 @@ Add the module docstring here. This will be used by the setup.py script.
|
||||
__revision__ = "$%s$"
|
||||
__author__ = ''
|
||||
|
||||
import plugins
|
||||
import supybot.plugins as plugins
|
||||
|
||||
import conf
|
||||
import utils
|
||||
import privmsgs
|
||||
import callbacks
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
|
||||
def configure(advanced):
|
||||
|
@ -5,7 +5,7 @@ import sys
|
||||
|
||||
import supybot
|
||||
|
||||
import fix
|
||||
import supybot.fix as fix
|
||||
|
||||
import re
|
||||
import sets
|
||||
@ -16,10 +16,10 @@ import logging
|
||||
import optparse
|
||||
from itertools import imap
|
||||
|
||||
import ansi
|
||||
import utils
|
||||
import ircutils
|
||||
import registry
|
||||
import supybot.ansi as ansi
|
||||
import supybot.utils as utils
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.registry as registry
|
||||
|
||||
import questions
|
||||
from questions import output, yn, anything, something, expect, getpass
|
||||
@ -41,7 +41,7 @@ def getPlugins(pluginDirs):
|
||||
return plugins
|
||||
|
||||
def loadPlugin(name):
|
||||
import Owner
|
||||
import supybot.Owner as Owner
|
||||
try:
|
||||
module = Owner.loadPluginModule(name)
|
||||
if hasattr(module, 'Class'):
|
||||
@ -124,8 +124,8 @@ def getRegistryValue(setting, prompt='', showHelp=True, showType=True):
|
||||
return ret
|
||||
|
||||
def main():
|
||||
import log
|
||||
import conf
|
||||
import supybot.log as log
|
||||
import supybot.conf as conf
|
||||
log._stdoutHandler.setLevel(100) # *Nothing* gets through this!
|
||||
parser = optparse.OptionParser(usage='Usage: %prog [options] [configFile]',
|
||||
version='Supybot %s' % conf.version)
|
||||
@ -468,7 +468,7 @@ def main():
|
||||
you can add users to your bot's user database, it's *very* important that
|
||||
you have an owner user for you bot.""")
|
||||
if yn('Would you like to add an owner user for your bot?', default=True):
|
||||
import ircdb
|
||||
import supybot.ircdb as ircdb
|
||||
name = something('What should the owner\'s username be?')
|
||||
try:
|
||||
id = ircdb.users.getUserId(name)
|
||||
@ -511,7 +511,7 @@ def main():
|
||||
on accident). You can even have more than one. I (jemfinch) am quite
|
||||
partial to @, but that's because I've been using it since my ocamlbot
|
||||
days.""")
|
||||
import callbacks
|
||||
import supybot.callbacks as callbacks
|
||||
c = ''
|
||||
while not c:
|
||||
try:
|
||||
@ -683,7 +683,7 @@ if __name__ == '__main__':
|
||||
except KeyboardInterrupt:
|
||||
# We may still be using bold text when exiting during a prompt
|
||||
if questions.useBold:
|
||||
import ansi
|
||||
import supybot.ansi as ansi
|
||||
print ansi.RESET
|
||||
print
|
||||
print
|
||||
|
13
setup.py
13
setup.py
@ -62,9 +62,8 @@ setup(
|
||||
url='http://supybot.sf.net/',
|
||||
author='Jeremy Fincher',
|
||||
author_email='jemfinch@users.sf.net',
|
||||
#description='A highly robust and full-featured IRC library and bot.',
|
||||
description='A flexible and extensible Python IRC bot and framework.',
|
||||
long_description="""A full-featured Python IRC bot with a clean and
|
||||
long_description="""A robust, full-featured Python IRC bot with a clean and
|
||||
flexible plugin API. Equipped with a complete ACL system for specifying
|
||||
user permissions with as much as per-command granularity. Batteries are
|
||||
included in the form of numerous plugins already written.""",
|
||||
@ -86,15 +85,11 @@ setup(
|
||||
|
||||
# Installation data
|
||||
packages=['supybot',
|
||||
'supybot.src',
|
||||
'supybot.others',
|
||||
'supybot.plugins',
|
||||
'supybot.others.IMDb',],
|
||||
package_dir={'supybot': os.curdir,
|
||||
'supybot.src': 'src',
|
||||
'supybot.plugins',],
|
||||
package_dir={'supybot': 'src',
|
||||
'supybot.others': 'others',
|
||||
'supybot.plugins': 'plugins',
|
||||
'supybot.others.IMDb': os.path.join('others', 'IMDb'),},
|
||||
'supybot.plugins': 'plugins',},
|
||||
scripts=['scripts/supybot',
|
||||
'scripts/supybot-wizard',
|
||||
'scripts/supybot-adduser',
|
||||
|
20
src/Admin.py
20
src/Admin.py
@ -37,7 +37,7 @@ caller to have the 'admin' capability. This plugin is loaded by default.
|
||||
__revision__ = "$Id$"
|
||||
__author__ = 'Jeremy Fincher (jemfinch) <jemfinch@users.sf.net>'
|
||||
|
||||
import fix
|
||||
import supybot.fix as fix
|
||||
|
||||
import time
|
||||
import pprint
|
||||
@ -47,15 +47,15 @@ import smtplib
|
||||
import textwrap
|
||||
from itertools import imap
|
||||
|
||||
import log
|
||||
import conf
|
||||
import ircdb
|
||||
import utils
|
||||
import ircmsgs
|
||||
import ircutils
|
||||
import privmsgs
|
||||
import schedule
|
||||
import callbacks
|
||||
import supybot.log as log
|
||||
import supybot.conf as conf
|
||||
import supybot.ircdb as ircdb
|
||||
import supybot.utils as utils
|
||||
import supybot.ircmsgs as ircmsgs
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.schedule as schedule
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
|
||||
class Admin(privmsgs.CapabilityCheckingPrivmsg):
|
||||
|
@ -37,21 +37,21 @@ to have the <channel>.op capability. This plugin is loaded by default.
|
||||
__revision__ = "$Id$"
|
||||
__author__ = 'Jeremy Fincher (jemfinch) <jemfinch@users.sf.net>'
|
||||
|
||||
import fix
|
||||
import supybot.fix as fix
|
||||
|
||||
import time
|
||||
import getopt
|
||||
from itertools import imap
|
||||
|
||||
import conf
|
||||
import ircdb
|
||||
import utils
|
||||
import ircmsgs
|
||||
import schedule
|
||||
import ircutils
|
||||
import privmsgs
|
||||
import registry
|
||||
import callbacks
|
||||
import supybot.conf as conf
|
||||
import supybot.ircdb as ircdb
|
||||
import supybot.utils as utils
|
||||
import supybot.ircmsgs as ircmsgs
|
||||
import supybot.schedule as schedule
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.registry as registry
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
conf.registerPlugin('Channel')
|
||||
conf.registerChannelValue(conf.supybot.plugins.Channel, 'alwaysRejoin',
|
||||
|
@ -38,15 +38,15 @@ __author__ = 'Jeremy Fincher (jemfinch) <jemfinch@users.sf.net>'
|
||||
|
||||
import getopt
|
||||
|
||||
import conf
|
||||
import utils
|
||||
import world
|
||||
import ircdb
|
||||
import plugins
|
||||
import ircutils
|
||||
import privmsgs
|
||||
import registry
|
||||
import callbacks
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.world as world
|
||||
import supybot.ircdb as ircdb
|
||||
import supybot.plugins as plugins
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.registry as registry
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
###
|
||||
# Now, to setup the registry.
|
||||
|
20
src/Misc.py
20
src/Misc.py
@ -36,22 +36,22 @@ Miscellaneous commands.
|
||||
__revision__ = "$Id$"
|
||||
__author__ = 'Jeremy Fincher (jemfinch) <jemfinch@users.sf.net>'
|
||||
|
||||
import fix
|
||||
import supybot.fix as fix
|
||||
|
||||
import os
|
||||
import sys
|
||||
import getopt
|
||||
from itertools import imap, ifilter
|
||||
|
||||
import conf
|
||||
import utils
|
||||
import ircdb
|
||||
import irclib
|
||||
import ircmsgs
|
||||
import ircutils
|
||||
import privmsgs
|
||||
import webutils
|
||||
import callbacks
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.ircdb as ircdb
|
||||
import supybot.irclib as irclib
|
||||
import supybot.ircmsgs as ircmsgs
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.webutils as webutils
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
class Misc(callbacks.Privmsg):
|
||||
priority = sys.maxint
|
||||
|
24
src/Owner.py
24
src/Owner.py
@ -37,7 +37,7 @@ their caller to have the 'owner' capability. This plugin is loaded by default.
|
||||
__revision__ = "$Id$"
|
||||
__author__ = 'Jeremy Fincher (jemfinch) <jemfinch@users.sf.net>'
|
||||
|
||||
import fix
|
||||
import supybot.fix as fix
|
||||
|
||||
import gc
|
||||
import os
|
||||
@ -48,17 +48,17 @@ import getopt
|
||||
import logging
|
||||
import linecache
|
||||
|
||||
import log
|
||||
import conf
|
||||
import utils
|
||||
import world
|
||||
import ircdb
|
||||
import irclib
|
||||
import ircmsgs
|
||||
import drivers
|
||||
import privmsgs
|
||||
import registry
|
||||
import callbacks
|
||||
import supybot.log as log
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.world as world
|
||||
import supybot.ircdb as ircdb
|
||||
import supybot.irclib as irclib
|
||||
import supybot.ircmsgs as ircmsgs
|
||||
import supybot.drivers as drivers
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.registry as registry
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
class Deprecated(ImportError):
|
||||
pass
|
||||
|
16
src/User.py
16
src/User.py
@ -36,7 +36,7 @@ Provides commands useful to users in general. This plugin is loaded by default.
|
||||
__revision__ = "$Id$"
|
||||
__author__ = 'Jeremy Fincher (jemfinch) <jemfinch@users.sf.net>'
|
||||
|
||||
import fix
|
||||
import supybot.fix as fix
|
||||
|
||||
import re
|
||||
import getopt
|
||||
@ -44,14 +44,14 @@ import string
|
||||
import fnmatch
|
||||
from itertools import imap, ifilter
|
||||
|
||||
import conf
|
||||
import utils
|
||||
import ircdb
|
||||
import ircutils
|
||||
import privmsgs
|
||||
import callbacks
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.ircdb as ircdb
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.privmsgs as privmsgs
|
||||
import supybot.callbacks as callbacks
|
||||
|
||||
import Config
|
||||
import supybot.Config as Config
|
||||
|
||||
class User(callbacks.Privmsg):
|
||||
def _checkNotChannel(self, irc, msg, password=' '):
|
||||
|
@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
###
|
||||
# Copyright (c) 2002, Jeremiah Fincher
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions, and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions, and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the author of this software nor the name of
|
||||
# contributors to this software may be used to endorse or promote products
|
||||
# derived from this software without specific prior written consent.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
###
|
||||
|
||||
import sys
|
||||
import os.path
|
||||
|
||||
installDir = os.path.dirname(sys.modules[__name__].__file__)
|
||||
|
||||
srcDir = os.path.join(installDir, 'src')
|
||||
othersDir = os.path.join(installDir, 'others')
|
||||
|
||||
sys.path.insert(0, othersDir)
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
@ -31,7 +31,7 @@
|
||||
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import fix
|
||||
import supybot.fix as fix
|
||||
|
||||
import re
|
||||
import sys
|
||||
@ -40,13 +40,13 @@ import socket
|
||||
import asyncore
|
||||
import asynchat
|
||||
|
||||
import log
|
||||
import conf
|
||||
import ircdb
|
||||
import world
|
||||
import drivers
|
||||
import ircmsgs
|
||||
import schedule
|
||||
import supybot.log as log
|
||||
import supybot.conf as conf
|
||||
import supybot.ircdb as ircdb
|
||||
import supybot.world as world
|
||||
import supybot.drivers as drivers
|
||||
import supybot.ircmsgs as ircmsgs
|
||||
import supybot.schedule as schedule
|
||||
|
||||
class AsyncoreRunnerDriver(drivers.IrcDriver):
|
||||
def run(self):
|
||||
|
@ -40,7 +40,7 @@ how to use them.
|
||||
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import fix
|
||||
import supybot.fix as fix
|
||||
|
||||
import re
|
||||
import copy
|
||||
@ -54,15 +54,15 @@ import threading
|
||||
from cStringIO import StringIO
|
||||
from itertools import imap, ifilter
|
||||
|
||||
import log
|
||||
import conf
|
||||
import utils
|
||||
import world
|
||||
import ircdb
|
||||
import irclib
|
||||
import plugins
|
||||
import ircmsgs
|
||||
import ircutils
|
||||
import supybot.log as log
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.world as world
|
||||
import supybot.ircdb as ircdb
|
||||
import supybot.irclib as irclib
|
||||
import supybot.plugins as plugins
|
||||
import supybot.ircmsgs as ircmsgs
|
||||
import supybot.ircutils as ircutils
|
||||
|
||||
def addressed(nick, msg, prefixChars=None, whenAddressedByNick=None):
|
||||
"""If msg is addressed to 'name', returns the portion after the address.
|
||||
|
@ -36,7 +36,7 @@ the same as) DJB's CDB <http://cr.yp.to/cdb.html>.
|
||||
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import fix
|
||||
import supybot.fix as fix
|
||||
|
||||
import os
|
||||
import sys
|
||||
@ -45,7 +45,7 @@ import struct
|
||||
import os.path
|
||||
import cPickle as pickle
|
||||
|
||||
import utils
|
||||
import supybot.utils as utils
|
||||
|
||||
def hash(s):
|
||||
"""DJB's hash function for CDB."""
|
||||
|
14
src/conf.py
14
src/conf.py
@ -31,19 +31,19 @@
|
||||
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import fix
|
||||
import supybot.fix as fix
|
||||
|
||||
import os
|
||||
import sys
|
||||
import socket
|
||||
import string
|
||||
|
||||
import utils
|
||||
import registry
|
||||
import ircutils
|
||||
import supybot.utils as utils
|
||||
import supybot.registry as registry
|
||||
import supybot.ircutils as ircutils
|
||||
|
||||
installDir = os.path.dirname(os.path.dirname(sys.modules[__name__].__file__))
|
||||
_srcDir = os.path.join(installDir, 'src')
|
||||
installDir = os.path.dirname(sys.modules[__name__].__file__)
|
||||
_srcDir = installDir
|
||||
_pluginsDir = os.path.join(installDir, 'plugins')
|
||||
|
||||
###
|
||||
@ -506,7 +506,7 @@ registerGlobalValue(supybot.directories, 'conf',
|
||||
registerGlobalValue(supybot.directories, 'data',
|
||||
registry.String('data', """Determines what directory data is put into."""))
|
||||
registerGlobalValue(supybot.directories, 'plugins',
|
||||
registry.CommaSeparatedListOfStrings([_srcDir,_pluginsDir], """Determines
|
||||
registry.CommaSeparatedListOfStrings([_srcDir, _pluginsDir], """Determines
|
||||
what directories the bot will look for plugins in. Accepts a
|
||||
comma-separated list of strings. This means that to add another directory,
|
||||
you can nest the former value and add a new one. E.g. you can say: bot:
|
||||
|
@ -35,16 +35,16 @@ Contains various drivers (network, file, and otherwise) for using IRC objects.
|
||||
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import fix
|
||||
import supybot.fix as fix
|
||||
|
||||
import re
|
||||
import os
|
||||
import sys
|
||||
|
||||
import log
|
||||
import conf
|
||||
import ansi
|
||||
import ircmsgs
|
||||
import supybot.log as log
|
||||
import supybot.conf as conf
|
||||
import supybot.ansi as ansi
|
||||
import supybot.ircmsgs as ircmsgs
|
||||
|
||||
_drivers = {}
|
||||
_deadDrivers = []
|
||||
@ -118,11 +118,14 @@ def newDriver(server, irc, moduleName=None):
|
||||
if moduleName == 'default':
|
||||
try:
|
||||
import twistedDrivers
|
||||
moduleName = 'twistedDrivers'
|
||||
moduleName = 'supybot.twistedDrivers'
|
||||
except ImportError:
|
||||
del sys.modules['twistedDrivers']
|
||||
moduleName = 'socketDrivers'
|
||||
driver = __import__(moduleName).Driver(server, irc)
|
||||
del sys.modules['supybot.twistedDrivers']
|
||||
moduleName = 'supybot.socketDrivers'
|
||||
elif not moduleName.startswith('supybot.'):
|
||||
moduleName = 'supybot.' + moduleName
|
||||
driverModule = __import__(moduleName, {}, {}, ['not empty'])
|
||||
driver = driverModule.Driver(server, irc)
|
||||
irc.driver = driver
|
||||
return driver
|
||||
|
||||
|
14
src/ircdb.py
14
src/ircdb.py
@ -33,7 +33,7 @@ __revision__ = "$Id$"
|
||||
|
||||
from __future__ import division
|
||||
|
||||
import fix
|
||||
import supybot.fix as fix
|
||||
|
||||
import os
|
||||
import sets
|
||||
@ -41,12 +41,12 @@ import time
|
||||
import string
|
||||
from itertools import imap, ilen, ifilter
|
||||
|
||||
import log
|
||||
import conf
|
||||
import utils
|
||||
import world
|
||||
import ircutils
|
||||
import unpreserve
|
||||
import supybot.log as log
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.world as world
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.unpreserve as unpreserve
|
||||
|
||||
def fromChannelCapability(capability):
|
||||
"""Returns a (channel, capability) tuple from a channel capability."""
|
||||
|
@ -31,21 +31,21 @@
|
||||
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import fix
|
||||
import supybot.fix as fix
|
||||
|
||||
import copy
|
||||
import sets
|
||||
import time
|
||||
from itertools import imap, chain, cycle
|
||||
|
||||
import log
|
||||
import conf
|
||||
import utils
|
||||
import world
|
||||
import ircdb
|
||||
import ircmsgs
|
||||
import ircutils
|
||||
from structures import queue, smallqueue, RingBuffer
|
||||
import supybot.log as log
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.world as world
|
||||
import supybot.ircdb as ircdb
|
||||
import supybot.ircmsgs as ircmsgs
|
||||
import supybot.ircutils as ircutils
|
||||
from supybot.structures import queue, smallqueue, RingBuffer
|
||||
|
||||
###
|
||||
# The base class for a callback to be registered with an Irc object. Shows
|
||||
|
@ -38,14 +38,14 @@ object (which, as you'll read later, is quite...full-featured :))
|
||||
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import fix
|
||||
import supybot.fix as fix
|
||||
|
||||
import re
|
||||
import time
|
||||
import string
|
||||
|
||||
import conf
|
||||
import ircutils
|
||||
import supybot.conf as conf
|
||||
import supybot.ircutils as ircutils
|
||||
|
||||
###
|
||||
# IrcMsg class -- used for representing IRC messages acquired from a network.
|
||||
|
@ -38,7 +38,7 @@ IRC-case-insensitive fashion), and numerous other things.
|
||||
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import fix
|
||||
import supybot.fix as fix
|
||||
|
||||
import re
|
||||
import copy
|
||||
@ -53,7 +53,7 @@ import textwrap
|
||||
from itertools import imap
|
||||
from cStringIO import StringIO as sio
|
||||
|
||||
import utils
|
||||
import supybot.utils as utils
|
||||
|
||||
def debug(s, *args):
|
||||
"""Prints a debug string. Most likely replaced by our logging debug."""
|
||||
|
12
src/log.py
12
src/log.py
@ -31,7 +31,7 @@
|
||||
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import fix
|
||||
import supybot.fix as fix
|
||||
|
||||
import os
|
||||
import sys
|
||||
@ -42,12 +42,12 @@ import logging
|
||||
import operator
|
||||
import traceback
|
||||
|
||||
import ansi
|
||||
import conf
|
||||
import utils
|
||||
import registry
|
||||
import supybot.ansi as ansi
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.registry as registry
|
||||
|
||||
import ircutils
|
||||
import supybot.ircutils as ircutils
|
||||
|
||||
deadlyExceptions = [KeyboardInterrupt, SystemExit]
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import fix
|
||||
import supybot.fix as fix
|
||||
|
||||
import gc
|
||||
import os
|
||||
@ -45,13 +45,13 @@ import urllib2
|
||||
import UserDict
|
||||
import threading
|
||||
|
||||
import cdb
|
||||
import log
|
||||
import conf
|
||||
import utils
|
||||
import world
|
||||
import ircutils
|
||||
import webutils
|
||||
import supybot.cdb as cdb
|
||||
import supybot.log as log
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.world as world
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.webutils as webutils
|
||||
|
||||
try:
|
||||
mxCrap = {}
|
||||
|
@ -35,20 +35,20 @@ Includes various accessories for callbacks.Privmsg based callbacks.
|
||||
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import fix
|
||||
import supybot.fix as fix
|
||||
|
||||
import time
|
||||
import types
|
||||
import threading
|
||||
|
||||
import conf
|
||||
import utils
|
||||
import world
|
||||
import ircdb
|
||||
import ircmsgs
|
||||
import ircutils
|
||||
import callbacks
|
||||
import structures
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.world as world
|
||||
import supybot.ircdb as ircdb
|
||||
import supybot.ircmsgs as ircmsgs
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.callbacks as callbacks
|
||||
import supybot.structures as structures
|
||||
|
||||
def getChannel(msg, args, raiseError=True):
|
||||
"""Returns the channel the msg came over or the channel given in args.
|
||||
|
@ -37,8 +37,8 @@ import sys
|
||||
import textwrap
|
||||
from getpass import getpass as getPass
|
||||
|
||||
import ansi
|
||||
import utils
|
||||
import supybot.ansi as ansi
|
||||
import supybot.utils as utils
|
||||
|
||||
useBold = False
|
||||
|
||||
|
@ -38,8 +38,8 @@ import time
|
||||
import types
|
||||
import textwrap
|
||||
|
||||
import fix
|
||||
import utils
|
||||
import supybot.fix as fix
|
||||
import supybot.utils as utils
|
||||
|
||||
class RegistryException(Exception):
|
||||
pass
|
||||
|
@ -33,13 +33,13 @@
|
||||
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import fix
|
||||
import supybot.fix as fix
|
||||
|
||||
import sys
|
||||
import traceback
|
||||
from cStringIO import StringIO
|
||||
|
||||
import log
|
||||
import supybot.log as log
|
||||
|
||||
filename = 'repl'
|
||||
|
||||
|
@ -36,13 +36,13 @@ Supybot driver.
|
||||
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import fix
|
||||
import supybot.fix as fix
|
||||
|
||||
import time
|
||||
import heapq
|
||||
|
||||
import log
|
||||
import drivers
|
||||
import supybot.log as log
|
||||
import supybot.drivers as drivers
|
||||
|
||||
class mytuple(tuple):
|
||||
def __cmp__(self, other):
|
||||
|
@ -37,7 +37,7 @@ from __future__ import division
|
||||
|
||||
__revision__ ="$Id$"
|
||||
|
||||
import fix
|
||||
import supybot.fix as fix
|
||||
|
||||
import time
|
||||
import atexit
|
||||
@ -45,13 +45,13 @@ import select
|
||||
import socket
|
||||
from itertools import imap
|
||||
|
||||
import log
|
||||
import conf
|
||||
import utils
|
||||
import world
|
||||
import drivers
|
||||
import ircmsgs
|
||||
import schedule
|
||||
import supybot.log as log
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.world as world
|
||||
import supybot.drivers as drivers
|
||||
import supybot.ircmsgs as ircmsgs
|
||||
import supybot.schedule as schedule
|
||||
|
||||
instances = 0
|
||||
originalPoll = conf.supybot.drivers.poll()
|
||||
|
@ -37,7 +37,7 @@ Data structures for Python.
|
||||
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import fix
|
||||
import supybot.fix as fix
|
||||
|
||||
import types
|
||||
import pprint
|
||||
|
@ -31,15 +31,15 @@
|
||||
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import fix
|
||||
import supybot.fix as fix
|
||||
|
||||
import time
|
||||
|
||||
import log
|
||||
import conf
|
||||
import ircdb
|
||||
import drivers
|
||||
import ircmsgs
|
||||
import supybot.log as log
|
||||
import supybot.conf as conf
|
||||
import supybot.ircdb as ircdb
|
||||
import supybot.drivers as drivers
|
||||
import supybot.ircmsgs as ircmsgs
|
||||
|
||||
from twisted.internet import reactor
|
||||
from twisted.protocols.basic import LineReceiver
|
||||
|
@ -35,7 +35,7 @@ Simple utility functions.
|
||||
|
||||
__revision__ = "$Id$"
|
||||
|
||||
import fix
|
||||
import supybot.fix as fix
|
||||
|
||||
import os
|
||||
import re
|
||||
@ -52,7 +52,7 @@ import UserDict
|
||||
import htmlentitydefs
|
||||
from itertools import imap, ifilter
|
||||
|
||||
from structures import TwoWayDictionary
|
||||
from supybot.structures import TwoWayDictionary
|
||||
|
||||
curry = new.instancemethod
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user