mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-02-18 14:40:51 +01:00
Changed supybot.defaultCapabilities to a space-separated list, made prefixChars channel-specific, and a few other quick changes.
This commit is contained in:
parent
741fc1d8d0
commit
2f2b7bd6c1
@ -1,3 +1,10 @@
|
|||||||
|
* Added an Infobot plugin, to emulate Infobot.
|
||||||
|
|
||||||
|
* Changed supybot.defaultCapabilities to be a space-separated
|
||||||
|
list rather than a comma-separated list. Also added a check to
|
||||||
|
make sure -owner was in supybot.defaultCapabilities, and to
|
||||||
|
require a command-line option to allow it not to be present.
|
||||||
|
|
||||||
* Added Sourceforge.fight, which returns the list of specified
|
* Added Sourceforge.fight, which returns the list of specified
|
||||||
projects and their bug/rfe count in sorted order, least to most.
|
projects and their bug/rfe count in sorted order, least to most.
|
||||||
|
|
||||||
|
4
RELNOTES
4
RELNOTES
@ -1,3 +1,7 @@
|
|||||||
|
supybot.defaultCapabilities is space-separated now, not
|
||||||
|
comma-separated. You you should remove the commas from this value in
|
||||||
|
your configuration file before loading the bot.
|
||||||
|
|
||||||
Version 0.77.2
|
Version 0.77.2
|
||||||
|
|
||||||
This is a drop-in replacement for 0.77.1, with two exceptions. The
|
This is a drop-in replacement for 0.77.1, with two exceptions. The
|
||||||
|
@ -143,6 +143,13 @@ if __name__ == '__main__':
|
|||||||
dest='allowEval',
|
dest='allowEval',
|
||||||
help='Determines whether the bot will '
|
help='Determines whether the bot will '
|
||||||
'allow the evaluation of arbitrary Python code.')
|
'allow the evaluation of arbitrary Python code.')
|
||||||
|
parser.add_option('', '--allow-default-owner', action='store_true',
|
||||||
|
dest='allowDefaultOwner',
|
||||||
|
help='Determines whether the bot will allow its '
|
||||||
|
'defaultCapabilities not to include "-owner", thus '
|
||||||
|
'giving all users the owner capability by default. '
|
||||||
|
'This is dumb, hence we require a command-line '
|
||||||
|
'option. Don\'t do this.')
|
||||||
parser.add_option('', '--allow-root', action='store_true',
|
parser.add_option('', '--allow-root', action='store_true',
|
||||||
dest='allowRoot',
|
dest='allowRoot',
|
||||||
help='Determines whether the bot will be allowed to run'
|
help='Determines whether the bot will be allowed to run'
|
||||||
@ -327,6 +334,7 @@ if __name__ == '__main__':
|
|||||||
log.warning('Psyco isn\'t installed, cannot -OO.')
|
log.warning('Psyco isn\'t installed, cannot -OO.')
|
||||||
|
|
||||||
conf.allowEval = options.allowEval
|
conf.allowEval = options.allowEval
|
||||||
|
conf.allowDefaultOwner = options.allowDefaultOwner
|
||||||
|
|
||||||
if not os.path.exists(conf.supybot.directories.log()):
|
if not os.path.exists(conf.supybot.directories.log()):
|
||||||
os.mkdir(conf.supybot.directories.log())
|
os.mkdir(conf.supybot.directories.log())
|
||||||
|
@ -52,8 +52,8 @@ import string
|
|||||||
import inspect
|
import inspect
|
||||||
import textwrap
|
import textwrap
|
||||||
import threading
|
import threading
|
||||||
from itertools import imap, ifilter
|
|
||||||
from cStringIO import StringIO
|
from cStringIO import StringIO
|
||||||
|
from itertools import imap, ifilter
|
||||||
|
|
||||||
import log
|
import log
|
||||||
import conf
|
import conf
|
||||||
@ -70,12 +70,15 @@ def addressed(nick, msg, prefixChars=None, whenAddressedByNick=None):
|
|||||||
Otherwise returns the empty string.
|
Otherwise returns the empty string.
|
||||||
"""
|
"""
|
||||||
assert msg.command == 'PRIVMSG'
|
assert msg.command == 'PRIVMSG'
|
||||||
|
(target, payload) = msg.args
|
||||||
|
registryPrefixChars = conf.supybot.prefixChars
|
||||||
|
if ircutils.isChannel(target):
|
||||||
|
registryPrefixChars = conf.supybot.prefixChars.get(target)
|
||||||
if prefixChars is None:
|
if prefixChars is None:
|
||||||
prefixChars = conf.supybot.prefixChars()
|
prefixChars = registryPrefixChars()
|
||||||
if whenAddressedByNick is None:
|
if whenAddressedByNick is None:
|
||||||
whenAddressedByNick = conf.supybot.reply.whenAddressedByNick()
|
whenAddressedByNick = conf.supybot.reply.whenAddressedByNick()
|
||||||
nick = ircutils.toLower(nick)
|
nick = ircutils.toLower(nick)
|
||||||
(target, payload) = msg.args
|
|
||||||
# Ok, let's see if it's a private message.
|
# Ok, let's see if it's a private message.
|
||||||
if ircutils.nickEqual(target, nick):
|
if ircutils.nickEqual(target, nick):
|
||||||
if payload[0] in prefixChars:
|
if payload[0] in prefixChars:
|
||||||
|
88
src/conf.py
88
src/conf.py
@ -65,6 +65,14 @@ daemonized = False
|
|||||||
###
|
###
|
||||||
allowEval = False
|
allowEval = False
|
||||||
|
|
||||||
|
###
|
||||||
|
# allowDefaultOwner: True if the defaultCapabilities are allowed not to include
|
||||||
|
# '-owner' -- that is, if all users should be automatically
|
||||||
|
# recognized as owners. That would suck, hence we require a
|
||||||
|
# command-line option to allow this stupidity.
|
||||||
|
###
|
||||||
|
allowDefaultOwner = False
|
||||||
|
|
||||||
###
|
###
|
||||||
# The standard registry.
|
# The standard registry.
|
||||||
###
|
###
|
||||||
@ -156,8 +164,9 @@ class SpaceSeparatedSetOfChannels(registry.SeparatedListOf):
|
|||||||
for removal in removals:
|
for removal in removals:
|
||||||
self.value.remove(discard)
|
self.value.remove(discard)
|
||||||
|
|
||||||
supybot.register('channels', SpaceSeparatedSetOfChannels(['#supybot'], """
|
registerGlobalValue(supybot, 'channels',
|
||||||
Determines what channels the bot will join when it connects to the server."""))
|
SpaceSeparatedSetOfChannels(['#supybot'], """Determines what channels the
|
||||||
|
bot will join when it connects to the server."""))
|
||||||
|
|
||||||
class ValidPrefixChars(registry.String):
|
class ValidPrefixChars(registry.String):
|
||||||
"""Value must contain only ~!@#$%^&*()_-+=[{}]\\|'\";:,<.>/?"""
|
"""Value must contain only ~!@#$%^&*()_-+=[{}]\\|'\";:,<.>/?"""
|
||||||
@ -166,37 +175,53 @@ class ValidPrefixChars(registry.String):
|
|||||||
self.error()
|
self.error()
|
||||||
registry.String.setValue(self, v)
|
registry.String.setValue(self, v)
|
||||||
|
|
||||||
supybot.register('prefixChars', ValidPrefixChars('', """Determines what prefix
|
registerChannelValue(supybot, 'prefixChars',
|
||||||
characters the bot will reply to. A prefix character is a single character
|
ValidPrefixChars('', """Determines what prefix characters the bot will
|
||||||
that the bot will use to determine what messages are addressed to it; when
|
reply to. A prefix character is a single character that the bot will use
|
||||||
there are no prefix characters set, it just uses its nick. Each character in
|
to determine what messages are addressed to it; when there are no prefix
|
||||||
this string is interpreted individually; you can have multiple prefixChars
|
characters set, it just uses its nick. Each character in this string is
|
||||||
simultaneously, and if any one of them is used as a prefix the bot will
|
interpreted individually; you can have multiple prefixChars simultaneously,
|
||||||
assume it is being addressed."""))
|
and if any one of them is used as a prefix the bot will assume it is being
|
||||||
|
addressed."""))
|
||||||
|
|
||||||
supybot.register('defaultCapabilities',
|
class DefaultCapabilities(registry.SpaceSeparatedListOfStrings):
|
||||||
registry.CommaSeparatedSetOfStrings(['-owner', '-admin', '-trusted'], """
|
List = ircutils.IrcSet
|
||||||
These are the capabilities that are given to everyone by default. If they are
|
def setValue(self, v):
|
||||||
normal capabilities, then the user will have to have the appropriate
|
registry.SpaceSeparatedListOfStrings.setValue(self, v)
|
||||||
|
if '-owner' not in self.value and not allowDefaultOwner:
|
||||||
|
print '*** You must run supybot with the --allow-default-owner'
|
||||||
|
print '*** option in order to allow a default capability of owner.'
|
||||||
|
print '*** Don\'t do that, it\'s dumb. In all likelihood, you\'re'
|
||||||
|
print '*** getting this message because you didn\'t remove the'
|
||||||
|
print '*** commas from your supybot.defaultCapabilities value in'
|
||||||
|
print '*** in your configuration file before start the bot.'
|
||||||
|
self.value.add('-owner')
|
||||||
|
|
||||||
|
registerGlobalValue(supybot, 'defaultCapabilities',
|
||||||
|
DefaultCapabilities(['-owner', '-admin', '-trusted'], """These are the
|
||||||
|
capabilities that are given to everyone by default. If they are normal
|
||||||
|
capabilities, then the user will have to have the appropriate
|
||||||
anti-capability if you want to override these capabilities; if they are
|
anti-capability if you want to override these capabilities; if they are
|
||||||
anti-capabilities, then the user will have to have the actual capability to
|
anti-capabilities, then the user will have to have the actual capability
|
||||||
override these capabilities. See docs/CAPABILITIES if you don't understand
|
to override these capabilities. See docs/CAPABILITIES if you don't
|
||||||
why these default to what they do."""))
|
understand why these default to what they do."""))
|
||||||
|
|
||||||
supybot.register('defaultAllow', registry.Boolean(True, """Determines whether
|
registerGlobalValue(supybot, 'defaultAllow',
|
||||||
the bot by default will allow users to run commands. If this is disabled, a
|
registry.Boolean(True, """Determines whether the bot by default will allow
|
||||||
user will have to have the capability for whatever command he wishes to run.
|
users to run commands. If this is disabled, a user will have to explicitly
|
||||||
"""))
|
have the capability for whatever command he wishes to run."""))
|
||||||
|
|
||||||
supybot.register('defaultIgnore', registry.Boolean(False, """Determines
|
registerGlobalValue(supybot, 'defaultIgnore',
|
||||||
whether the bot will ignore unregistered users by default. Of course, that'll
|
registry.Boolean(False, """Determines whether the bot will ignore
|
||||||
make it particularly hard for those users to register with the bot, but that's
|
unregistered users by default. Of course, that'll make it particularly
|
||||||
your problem to solve."""))
|
hard for those users to register with the bot, but that's your problem to
|
||||||
|
solve."""))
|
||||||
|
|
||||||
supybot.register('humanTimestampFormat', registry.String('%I:%M %p, %B %d, %Y',
|
registerGlobalValue(supybot, 'humanTimestampFormat',
|
||||||
"""Determines how timestamps printed for human reading should be formatted.
|
registry.String('%I:%M %p, %B %d, %Y', """Determines how timestamps printed
|
||||||
Refer to the Python documentation for the time module to see valid formatting
|
for human reading should be formatted. Refer to the Python documentation
|
||||||
characteres for time formats."""))
|
for the time module to see valid formatting characteres for time
|
||||||
|
formats."""))
|
||||||
|
|
||||||
class IP(registry.String):
|
class IP(registry.String):
|
||||||
"""Value must be a valid IP."""
|
"""Value must be a valid IP."""
|
||||||
@ -206,9 +231,10 @@ class IP(registry.String):
|
|||||||
else:
|
else:
|
||||||
registry.String.setValue(self, v)
|
registry.String.setValue(self, v)
|
||||||
|
|
||||||
supybot.register('externalIP', IP('', """A string that is the external IP of
|
registerGlobalValue(supybot, 'externalIP',
|
||||||
the bot. If this is the empty string, the bot will attempt to find out its IP
|
IP('', """A string that is the external IP of the bot. If this is the empty
|
||||||
dynamically (though sometimes that doesn't work, hence this variable)."""))
|
string, the bot will attempt to find out its IP dynamically (though
|
||||||
|
sometimes that doesn't work, hence this variable)."""))
|
||||||
|
|
||||||
###
|
###
|
||||||
# Reply/error tweaking.
|
# Reply/error tweaking.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user