I don't know how this got by as "working" before. Now it *really* does.

This commit is contained in:
James Vega 2005-01-03 21:57:20 +00:00
parent 57c3259cca
commit 8fc0c228d2

View File

@ -1,10 +1,12 @@
#!/usr/bin/env python #!/usr/bin/env python
import os import os
import sys import sys
import time
import sqlite import sqlite
import supybot.dbi as dbi import supybot.dbi as dbi
import supybot.conf as conf import supybot.conf as conf
import supybot.plugins as plugins
import supybot.ircutils as ircutils import supybot.ircutils as ircutils
import supybot.plugins.Lart as Lart import supybot.plugins.Lart as Lart
import supybot.plugins.Praise as Praise import supybot.plugins.Praise as Praise
@ -22,11 +24,12 @@ def main():
sys.exit(1) sys.exit(1)
sqldb = sys.argv[1] sqldb = sys.argv[1]
channel = sys.argv[2] channel = sys.argv[2]
if not ircutils.isChannel(channel): botname = 'an unkown user'
print '%s is an invalid channel name.' if len(sys.argv) == 4:
sys.exit(1)
if len(sys.argv) >= 4:
botname = sys.argv[3] botname = sys.argv[3]
if not ircutils.isChannel(channel):
print '%s is an invalid channel name.' % channel
sys.exit(1)
if not os.path.exists(sqldb): if not os.path.exists(sqldb):
print 'Unable to open %s' % sqldb print 'Unable to open %s' % sqldb
sys.exit(1) sys.exit(1)
@ -49,13 +52,15 @@ def main():
by = entry[2] by = entry[2]
if by is None: if by is None:
by = botname by = botname
plugin.add(channel, table, text, by) plugin.add(channel, time.time(), by, text)
success += 1 success += 1
except dbi.Error: except dbi.Error:
failed += 1 failed += 1
print '%s/%s entries successfully added. %s failed.' % (success, total, print '%s/%s entries successfully added. %s failed.' % (success, total,
failed) failed)
print 'Dbs are at: %s' % ', '.join((praises.filename, larts.filename)) pfile = plugins.makeChannelFilename(praises.filename, channel)
lfile = plugins.makeChannelFilename(larts.filename, channel)
print 'Dbs are at: %s' % ', '.join((pfile, lfile))
db.close() db.close()
praises.close() praises.close()
larts.close() larts.close()