1 import atexit
, bz2
, threadsafe_sched
, ircbot
, cPickle
, perms
7 autojoin_channels
= ("#casualgameplay", "#hal")
9 # Dummy where entry for privmsgs.
12 scheduler
= threadsafe_sched
.scheduler()
16 from ircbot
import IRCDict
18 factoid_dbs
= IRCDict()
19 locked_dbs
= IRCDict()
20 reminder_dbs
= IRCDict()
21 subscription_dbs
= IRCDict()
22 poke_via_msg
= IRCDict()
26 from cPickle
import dumps
as pickle
, loads
as depickle
31 pickled
= bz2
.decompress(zipped
)
32 (version
, data
) = depickle(pickled
)
33 if version
== SAVE_VERSION
:
34 (my_users
, factoid_dbs
, locked_dbs
, reminder_dbs
, subscription_dbs
, \
35 unlower
, poke_via_msg
) = data
37 (my_users
, factoid_dbs
, locked_dbs
, reminder_dbs
, subscription_dbs
, \
40 sys
.exit("Unrecognized database version.")
42 del db
, zipped
, pickled
46 def save(who
=None, where
=None, args
=None):
49 (my_users
, factoid_dbs
, locked_dbs
, reminder_dbs
,
50 subscription_dbs
, unlower
, poke_via_msg
)
52 zipped
= bz2
.compress(pickled
)
53 db
= open("hal.db", "w")
57 from basic_commands
import reply
58 reply(who
, where
, "Database saved.")
62 commands
['save'] = (perms
.ircop
, save
)