(large commit, see bazaar log)
[Bantracker] * Less spaces in README.txt * Remove mention of table 'users' in README.txt * Add more detail on how to create the bans database in README.txt * Add note about supybot-wizard creating the initial database in README.txt * Don't hard-code default values in config.py:configure() * Tweak config.py * Clean up bans.cgi a bit [Bugtracker] * Comment-out obsolete "bug reporting" variables in config.py * Update README.txt and remove "bug reporting" stuff, also remove extraneous license info * Comment-out obsolete "bug reporting" code * Don't import imaplib [Encyclopedia] * Don't hard-code default values in config.py:configure() * Check for 'owner' capability before checking if the hostmask is ignored in plugin.py:checkIgnored() * Clean up README.txt [PackageInfo] * Don't hard-code default values in config.py:configure() * Update default distributions in config.py:configure() * Update defaultRelease in config.py * Update README.txt * Add a few docstrings to commoncgi.py * Update COPYING * Update README.txt
This commit is contained in:
@ -1,23 +1,16 @@
|
||||
Copyright (c) 2006-2007, Dennis Kaarsemaker
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of version 2 of the GNU General Public License as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
This plugin used to have package lookup, this was mooved to the PackageInfo
|
||||
plugin.
|
||||
Factoid plugin
|
||||
Note: This plugin used to have package lookup, this was mooved to the
|
||||
PackageInfo plugin.
|
||||
|
||||
Pick a name for your database. A lowercase-only name without spaces is probably
|
||||
best, this example wil use myfactoids as name. Then create a directory to store
|
||||
your databases in (somewere in $botdir/data would be best). In the new directory
|
||||
create an sqlite database with the following command:
|
||||
your databases in (somewere in $botdir/data would be best).
|
||||
If you choose to enable this plugin during supybot-wizard the database will be
|
||||
created for you. If noy, you can create the database manually.
|
||||
In the new directory create an SQLite2 database with the following command:
|
||||
|
||||
sqlite myfactoids.db
|
||||
Then copy/paste in the below 2 tables:
|
||||
|
||||
CREATE TABLE facts (
|
||||
id INTEGER PRIMARY KEY,
|
||||
@ -36,6 +29,7 @@ CREATE TABLE log (
|
||||
oldvalue VARCHAR(200) NOT NULL
|
||||
);
|
||||
|
||||
|
||||
If you want to create more databases, repeat these last two steps.
|
||||
|
||||
When the databases exist, you need to configure the bots to actually use them.
|
||||
@ -44,9 +38,10 @@ dirand the channel value supybot.plugins.encyclopedia.database to the name of
|
||||
the database (without the .db suffix).
|
||||
|
||||
Documentation on adding/editing factoids can be found on
|
||||
https://wiki.ubuntu.com/UbuntuBots To give people edit access, let them register
|
||||
with your bot and use: %addeditor nickname_here (replace % with your prefix
|
||||
char). Similarly you can use removeeditor :).
|
||||
https://ubottu.com/devel/wiki/Plugins#Encyclopedia
|
||||
To give people edit access, let them register with your bot and use the command:
|
||||
@addeditor nickname_here
|
||||
(replace @ with your prefix char). Similarly you can use removeeditor :).
|
||||
|
||||
The web interface is a simple cgi script with some templates, css and the
|
||||
commoncgi.py file from the bzr tree. Make sure you set the variables datadir and
|
||||
|
@ -105,12 +105,12 @@ def configure(advanced):
|
||||
db_file = Encyclopedia.database()
|
||||
|
||||
if not db_dir:
|
||||
db_dir = conf.supybot.directories.data()
|
||||
db_dir = Encyclopedia.datadir._default
|
||||
output("supybot.plugins.Encyclopedia.datadir will be set to %r" % db_dir)
|
||||
Encyclopedia.datadir.setValue(db_dir)
|
||||
|
||||
if not db_file:
|
||||
db_file = 'ubuntu'
|
||||
db_file = Encyclopedia.database._default
|
||||
output("supybot.plugins.Encyclopedia.database will be set to %r" % db_file)
|
||||
Encyclopedia.database.setValue(db_dir)
|
||||
|
||||
|
@ -31,13 +31,14 @@ else:
|
||||
import sre as re
|
||||
|
||||
def checkIgnored(hostmask, recipient='', users=ircdb.users, channels=ircdb.channels):
|
||||
if ircdb.ignores.checkIgnored(hostmask):
|
||||
return True
|
||||
try:
|
||||
id = ircdb.users.getUserId(hostmask)
|
||||
user = users.getUser(id)
|
||||
except KeyError:
|
||||
# If there's no user...
|
||||
if ircdb.ignores.checkIgnored(hostmask):
|
||||
return True
|
||||
|
||||
if ircutils.isChannel(recipient):
|
||||
channel = channels.getChannel(recipient)
|
||||
if channel.checkIgnored(hostmask):
|
||||
@ -46,9 +47,13 @@ def checkIgnored(hostmask, recipient='', users=ircdb.users, channels=ircdb.chann
|
||||
return False
|
||||
else:
|
||||
return False
|
||||
|
||||
if user._checkCapability('owner'):
|
||||
# Owners shouldn't ever be ignored.
|
||||
return False
|
||||
|
||||
if ircdb.ignores.checkIgnored(hostmask):
|
||||
return True
|
||||
elif user.ignore:
|
||||
return True
|
||||
elif recipient:
|
||||
|
Reference in New Issue
Block a user