Added docstrings and method skeleton.

This commit is contained in:
Jeremy Fincher 2003-04-15 23:29:40 +00:00
parent 82c7d586ef
commit b40431cf31
1 changed files with 37 additions and 2 deletions

View File

@ -30,7 +30,8 @@
###
"""
Add the module docstring here. This will be used by the setup.py script.
A module to allow each channel to have "news" which people will be notified of
when they join the channel. News items may have expiration dates.
"""
from baseplugin import *
@ -41,7 +42,7 @@ import privmsgs
import callbacks
def configure(onStart, afterConnect):
def configure(onStart, afterConnect, advanced):
# This will be called by setup.py to configure this module. onStart and
# afterConnect are both lists. Append to onStart the commands you would
# like to be run when the bot is started; append to afterConnect the
@ -53,6 +54,7 @@ class News(callbacks.Privmsg, ChannelDBHandler):
def __init__(self):
ChannelDBHandler.__init__(self)
callbacks.Privmsg.__init__(self)
self.removeOld = False
def makeDb(self, filename):
if os.path.exists(filename):
@ -63,11 +65,44 @@ class News(callbacks.Privmsg, ChannelDBHandler):
id INTEGER PRIMARY KEY,
item TEXT,
added_at TIMESTAMP,
expires_at TIMESTAMP,
added_by TEXT
)""")
db.commit()
def addnews(self, irc, msg, args):
"""[<channel>] <expires> <text>
Adds a given news item of <text> to a channel. If <expires> isn't 0,
that news item will expire <expires> seconds from now. <channel> is
only necessary if the message isn't sent in the channel itself.
"""
pass
def removenews(self, irc, msg, args):
"""[<channel>] <number>
Removes the news item with id <number> from <channel>. <channel> is
only necessary if the message isn't sent in the channel itself.
"""
pass
def changenews(self, irc, msg, args):
"""[<channel>] <number> <regexp>
Changes the news item with id <number> from <channel> according to the
regular expression <regexp>. <regexp> should be of the form
s/text/replacement/flags. <channel> is only necessary if the message
isn't sent on the channel itself.
"""
pass
def oldnews(self, irc, msg, args):
"""[<channel>] <number>
Returns the old news item for <channel> with id <number>. <channel>
is only necessary if the message isn't sent in the channel itself.
"""
pass
Class = News