mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-30 06:04:21 +01:00
Variable name change, humanTimestampFormat => reply.format.time
This commit is contained in:
parent
595a787f8a
commit
0efb17dd81
@ -348,7 +348,7 @@ class Factoids(plugins.ChannelDBHandler, callbacks.Privmsg):
|
||||
counter = 0
|
||||
for (added_by, added_at) in factoids:
|
||||
counter += 1
|
||||
added_at = time.strftime(conf.supybot.humanTimestampFormat(),
|
||||
added_at = time.strftime(conf.supybot.reply.format.time(),
|
||||
time.localtime(int(added_at)))
|
||||
L.append('#%s was added by %s at %s' % (counter,added_by,added_at))
|
||||
factoids = '; '.join(L)
|
||||
|
@ -103,7 +103,7 @@ class Later(callbacks.Privmsg):
|
||||
fd.close()
|
||||
|
||||
def _timestamp(self, when):
|
||||
#format = conf.supybot.humanTimestampFormat()
|
||||
#format = conf.supybot.reply.format.time()
|
||||
diff = time.time() - when
|
||||
try:
|
||||
return utils.timeElapsed(diff, seconds=False) + ' ago'
|
||||
|
@ -496,19 +496,19 @@ class MoobotFactoids(callbacks.Privmsg):
|
||||
# First, creation info.
|
||||
# Map the integer created_by to the username
|
||||
creat_by = ircdb.users.getUser(created_by).name
|
||||
creat_at = time.strftime(conf.supybot.humanTimestampFormat(),
|
||||
creat_at = time.strftime(conf.supybot.reply.format.time(),
|
||||
time.localtime(int(created_at)))
|
||||
s += "Created by %s on %s." % (creat_by, creat_at)
|
||||
# Next, modification info, if any.
|
||||
if modified_by is not None:
|
||||
mod_by = ircdb.users.getUser(modified_by).name
|
||||
mod_at = time.strftime(conf.supybot.humanTimestampFormat(),
|
||||
mod_at = time.strftime(conf.supybot.reply.format.time(),
|
||||
time.localtime(int(modified_at)))
|
||||
s += " Last modified by %s on %s." % (mod_by, mod_at)
|
||||
# Next, last requested info, if any
|
||||
if last_requested_by is not None:
|
||||
last_by = last_requested_by # not an int user id
|
||||
last_at = time.strftime(conf.supybot.humanTimestampFormat(),
|
||||
last_at = time.strftime(conf.supybot.reply.format.time(),
|
||||
time.localtime(int(last_requested_at)))
|
||||
req_count = requested_count
|
||||
times_str = utils.nItems('time', requested_count)
|
||||
@ -516,7 +516,7 @@ class MoobotFactoids(callbacks.Privmsg):
|
||||
(last_by, last_at, times_str)
|
||||
# Last, locked info
|
||||
if locked_at is not None:
|
||||
lock_at = time.strftime(conf.supybot.humanTimestampFormat(),
|
||||
lock_at = time.strftime(conf.supybot.reply.format.time(),
|
||||
time.localtime(int(locked_at)))
|
||||
lock_by = ircdb.users.getUser(locked_by).name
|
||||
s += " Locked by %s on %s." % (lock_by, lock_at)
|
||||
|
@ -189,7 +189,7 @@ class Network(callbacks.Privmsg):
|
||||
channels = utils.commaAndify(L)
|
||||
if '317' in d:
|
||||
idle = utils.timeElapsed(d['317'].args[2])
|
||||
signon = time.strftime(conf.supybot.humanTimestampFormat(),
|
||||
signon = time.strftime(conf.supybot.reply.format.time(),
|
||||
time.localtime(float(d['317'].args[3])))
|
||||
else:
|
||||
idle = '<unknown>'
|
||||
|
@ -60,7 +60,7 @@ class DbiNewsDB(plugins.DbiChannelDB):
|
||||
]
|
||||
|
||||
def __str__(self):
|
||||
format = conf.supybot.humanTimestampFormat()
|
||||
format = conf.supybot.reply.format.time()
|
||||
user = plugins.getUserName(self.by)
|
||||
if self.expires == 0:
|
||||
s = '%s (Subject: "%s", added by %s on %s)' % \
|
||||
|
@ -70,7 +70,7 @@ class PollRecord(dbi.Record):
|
||||
'status'
|
||||
]
|
||||
def __str__(self):
|
||||
format = conf.supybot.humanTimestampFormat()
|
||||
format = conf.supybot.reply.format.time()
|
||||
user = plugins.getUserName(self.by)
|
||||
if self.options:
|
||||
options = 'Options: %s' % '; '.join(map(str, self.options))
|
||||
|
@ -83,7 +83,7 @@ class QuoteGrabsRecord(dbi.Record):
|
||||
]
|
||||
|
||||
def __str__(self):
|
||||
at = time.strftime(conf.supybot.humanTimestampFormat(),
|
||||
at = time.strftime(conf.supybot.reply.format.time(),
|
||||
time.localtime(float(self.at)))
|
||||
grabber = plugins.getUserName(self.grabber)
|
||||
return '%s (Said by: %s; grabbed by %s at %s)' % \
|
||||
|
@ -62,7 +62,7 @@ class QuoteRecord(dbi.Record):
|
||||
'text'
|
||||
]
|
||||
def __str__(self):
|
||||
format = conf.supybot.humanTimestampFormat()
|
||||
format = conf.supybot.reply.format.time()
|
||||
user = plugins.getUserName(self.by)
|
||||
return 'Quote %s added by %s at %s.' % \
|
||||
(utils.quoted(self.text), user,
|
||||
|
@ -288,7 +288,7 @@ class Relay(callbacks.Privmsg):
|
||||
channels = utils.commaAndify(L)
|
||||
if '317' in d:
|
||||
idle = utils.timeElapsed(d['317'].args[2])
|
||||
signon = time.strftime(conf.supybot.humanTimestampFormat(),
|
||||
signon = time.strftime(conf.supybot.reply.format.time(),
|
||||
time.localtime(float(d['317'].args[3])))
|
||||
else:
|
||||
idle = '<unknown>'
|
||||
|
@ -62,7 +62,7 @@ def configure(advanced):
|
||||
|
||||
conf.registerPlugin('Time')
|
||||
conf.registerChannelValue(conf.supybot.plugins.Time, 'format',
|
||||
registry.String(str(conf.supybot.humanTimestampFormat()), """Determines the
|
||||
registry.String(str(conf.supybot.reply.format.time()), """Determines the
|
||||
format string for timestamps. Refer to the Python documentation for the
|
||||
time module to see what formats are accepted. If you set this variable to
|
||||
the empty string, the timestamp will not be shown."""))
|
||||
|
@ -163,7 +163,7 @@ class Todo(callbacks.Privmsg):
|
||||
active = 'Inactive'
|
||||
if pri:
|
||||
task += ', priority: %s' % pri
|
||||
added_at = time.strftime(conf.supybot.humanTimestampFormat(),
|
||||
added_at = time.strftime(conf.supybot.reply.format.time(),
|
||||
time.localtime(int(added_at)))
|
||||
s = "%s todo for %s: %s (Added at %s)" % \
|
||||
(active, name, task, added_at)
|
||||
|
@ -480,7 +480,7 @@ class ChannelIdDatabasePlugin(callbacks.Privmsg):
|
||||
def showRecord(self, record):
|
||||
name = getUserName(record.by)
|
||||
at = time.localtime(record.at)
|
||||
timeS = time.strftime(conf.supybot.humanTimestampFormat(), at)
|
||||
timeS = time.strftime(conf.supybot.reply.format.time(), at)
|
||||
return '%s #%s: %s (added by %s at %s)' % \
|
||||
(self.name(), record.id, utils.quoted(record.text), name, timeS)
|
||||
|
||||
|
13
src/conf.py
13
src/conf.py
@ -274,7 +274,12 @@ for (name, s) in registry._cache.iteritems():
|
||||
registerGroup(supybot, 'reply')
|
||||
|
||||
registerGroup(supybot.reply, 'format')
|
||||
registerGroup(supybot.reply.format, 'time')
|
||||
registerChannelValue(supybot.reply.format, 'time',
|
||||
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 characters for time
|
||||
formats."""))
|
||||
|
||||
registerGroup(supybot.reply.format.time, 'elapsed')
|
||||
registerChannelValue(supybot.reply.format.time.elapsed, 'short',
|
||||
registry.Boolean(False, """Determines whether elapsed times will be given
|
||||
@ -910,12 +915,6 @@ registerGlobalValue(supybot, 'defaultIgnore',
|
||||
hard for those users to register or identify with the bot, but that's your
|
||||
problem to solve."""))
|
||||
|
||||
registerChannelValue(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 characters for time
|
||||
formats."""))
|
||||
|
||||
class IP(registry.String):
|
||||
"""Value must be a valid IP."""
|
||||
def setValue(self, v):
|
||||
|
Loading…
Reference in New Issue
Block a user