mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-29 22:29:24 +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
|
||||
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
|
||||
|
||||
This is a drop-in replacement for 0.77.1, with two exceptions. The
|
||||
|
@ -143,6 +143,13 @@ if __name__ == '__main__':
|
||||
dest='allowEval',
|
||||
help='Determines whether the bot will '
|
||||
'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',
|
||||
dest='allowRoot',
|
||||
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.')
|
||||
|
||||
conf.allowEval = options.allowEval
|
||||
conf.allowDefaultOwner = options.allowDefaultOwner
|
||||
|
||||
if not os.path.exists(conf.supybot.directories.log()):
|
||||
os.mkdir(conf.supybot.directories.log())
|
||||
|
@ -52,8 +52,8 @@ import string
|
||||
import inspect
|
||||
import textwrap
|
||||
import threading
|
||||
from itertools import imap, ifilter
|
||||
from cStringIO import StringIO
|
||||
from itertools import imap, ifilter
|
||||
|
||||
import log
|
||||
import conf
|
||||
@ -70,12 +70,15 @@ def addressed(nick, msg, prefixChars=None, whenAddressedByNick=None):
|
||||
Otherwise returns the empty string.
|
||||
"""
|
||||
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:
|
||||
prefixChars = conf.supybot.prefixChars()
|
||||
prefixChars = registryPrefixChars()
|
||||
if whenAddressedByNick is None:
|
||||
whenAddressedByNick = conf.supybot.reply.whenAddressedByNick()
|
||||
nick = ircutils.toLower(nick)
|
||||
(target, payload) = msg.args
|
||||
# Ok, let's see if it's a private message.
|
||||
if ircutils.nickEqual(target, nick):
|
||||
if payload[0] in prefixChars:
|
||||
|
90
src/conf.py
90
src/conf.py
@ -65,6 +65,14 @@ daemonized = 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.
|
||||
###
|
||||
@ -156,8 +164,9 @@ class SpaceSeparatedSetOfChannels(registry.SeparatedListOf):
|
||||
for removal in removals:
|
||||
self.value.remove(discard)
|
||||
|
||||
supybot.register('channels', SpaceSeparatedSetOfChannels(['#supybot'], """
|
||||
Determines what channels the bot will join when it connects to the server."""))
|
||||
registerGlobalValue(supybot, 'channels',
|
||||
SpaceSeparatedSetOfChannels(['#supybot'], """Determines what channels the
|
||||
bot will join when it connects to the server."""))
|
||||
|
||||
class ValidPrefixChars(registry.String):
|
||||
"""Value must contain only ~!@#$%^&*()_-+=[{}]\\|'\";:,<.>/?"""
|
||||
@ -166,37 +175,53 @@ class ValidPrefixChars(registry.String):
|
||||
self.error()
|
||||
registry.String.setValue(self, v)
|
||||
|
||||
supybot.register('prefixChars', ValidPrefixChars('', """Determines what prefix
|
||||
characters the bot will reply to. A prefix character is a single character
|
||||
that the bot will use to determine what messages are addressed to it; when
|
||||
there are no prefix characters set, it just uses its nick. Each character in
|
||||
this string is interpreted individually; you can have multiple prefixChars
|
||||
simultaneously, and if any one of them is used as a prefix the bot will
|
||||
assume it is being addressed."""))
|
||||
registerChannelValue(supybot, 'prefixChars',
|
||||
ValidPrefixChars('', """Determines what prefix characters the bot will
|
||||
reply to. A prefix character is a single character that the bot will use
|
||||
to determine what messages are addressed to it; when there are no prefix
|
||||
characters set, it just uses its nick. Each character in this string is
|
||||
interpreted individually; you can have multiple prefixChars simultaneously,
|
||||
and if any one of them is used as a prefix the bot will assume it is being
|
||||
addressed."""))
|
||||
|
||||
supybot.register('defaultCapabilities',
|
||||
registry.CommaSeparatedSetOfStrings(['-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-capabilities, then the user will have to have the actual capability to
|
||||
override these capabilities. See docs/CAPABILITIES if you don't understand
|
||||
why these default to what they do."""))
|
||||
class DefaultCapabilities(registry.SpaceSeparatedListOfStrings):
|
||||
List = ircutils.IrcSet
|
||||
def setValue(self, v):
|
||||
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')
|
||||
|
||||
supybot.register('defaultAllow', registry.Boolean(True, """Determines whether
|
||||
the bot by default will allow users to run commands. If this is disabled, a
|
||||
user will have to have the capability for whatever command he wishes to run.
|
||||
"""))
|
||||
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-capabilities, then the user will have to have the actual capability
|
||||
to override these capabilities. See docs/CAPABILITIES if you don't
|
||||
understand why these default to what they do."""))
|
||||
|
||||
supybot.register('defaultIgnore', registry.Boolean(False, """Determines
|
||||
whether the bot will ignore unregistered users by default. Of course, that'll
|
||||
make it particularly hard for those users to register with the bot, but that's
|
||||
your problem to solve."""))
|
||||
registerGlobalValue(supybot, 'defaultAllow',
|
||||
registry.Boolean(True, """Determines whether the bot by default will allow
|
||||
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('humanTimestampFormat', registry.String('%I:%M %p, %B %d, %Y',
|
||||
"""Determines how timestamps printed for human reading should be formatted.
|
||||
Refer to the Python documentation for the time module to see valid formatting
|
||||
characteres for time formats."""))
|
||||
registerGlobalValue(supybot, 'defaultIgnore',
|
||||
registry.Boolean(False, """Determines whether the bot will ignore
|
||||
unregistered users by default. Of course, that'll make it particularly
|
||||
hard for those users to register with the bot, but that's your problem to
|
||||
solve."""))
|
||||
|
||||
registerGlobalValue(supybot, 'humanTimestampFormat',
|
||||
registry.String('%I:%M %p, %B %d, %Y', """Determines how timestamps printed
|
||||
for human reading should be formatted. Refer to the Python documentation
|
||||
for the time module to see valid formatting characteres for time
|
||||
formats."""))
|
||||
|
||||
class IP(registry.String):
|
||||
"""Value must be a valid IP."""
|
||||
@ -206,9 +231,10 @@ class IP(registry.String):
|
||||
else:
|
||||
registry.String.setValue(self, v)
|
||||
|
||||
supybot.register('externalIP', IP('', """A string that is the external IP of
|
||||
the bot. If this is the empty string, the bot will attempt to find out its IP
|
||||
dynamically (though sometimes that doesn't work, hence this variable)."""))
|
||||
registerGlobalValue(supybot, 'externalIP',
|
||||
IP('', """A string that is the external IP of the bot. If this is the empty
|
||||
string, the bot will attempt to find out its IP dynamically (though
|
||||
sometimes that doesn't work, hence this variable)."""))
|
||||
|
||||
###
|
||||
# Reply/error tweaking.
|
||||
|
Loading…
Reference in New Issue
Block a user