supybot.reply.format.databaseRecord: Add $nick

This commit is contained in:
Valentin Lorentz 2020-05-14 18:56:16 +02:00
parent 4046a1b201
commit 7444e656d8
2 changed files with 5 additions and 2 deletions

View File

@ -444,10 +444,13 @@ class ChannelIdDatabasePlugin(callbacks.Plugin):
def showRecord(self, record): def showRecord(self, record):
template = string.Template(conf.supybot.reply.format.databaseRecord()) template = string.Template(conf.supybot.reply.format.databaseRecord())
username = getUserName(record.by)
nick = username.split('!')[0] # nick==username iff this is a registered user
return template.substitute( return template.substitute(
id=record.id, id=record.id,
text=record.text, text=record.text,
username=getUserName(record.by), username=username,
nick=nick,
at=record.at, at=record.at,
**self.typeSubstitutions(), **self.typeSubstitutions(),
) )

View File

@ -509,7 +509,7 @@ registerChannelValue(supybot.reply.format, 'databaseRecord',
_("""Format used by generic database plugins (Lart, Dunno, Prase, Success, _("""Format used by generic database plugins (Lart, Dunno, Prase, Success,
Quote, ...) to show an entry. You can use the following variables: Quote, ...) to show an entry. You can use the following variables:
$type/$types/$Type/$Types (plugin name and variants), $id, $text, $type/$types/$Type/$Types (plugin name and variants), $id, $text,
$userid/$username (author), $at (creation time)."""))) $at (creation time), $userid/$username/$nick (author).""")))
registerGlobalValue(supybot.reply, 'maximumLength', registerGlobalValue(supybot.reply, 'maximumLength',
registry.Integer(512*256, _("""Determines the absolute maximum length of registry.Integer(512*256, _("""Determines the absolute maximum length of