plugins/contact: use f-strings

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2022-03-23 16:10:36 +01:00
parent e010abcd95
commit cb50120d87
Signed by: pep
GPG key ID: DEDA74AEECA9D0F2

View file

@ -40,18 +40,18 @@ class Plugin(BasePlugin):
field_value = values[var]
if field_value:
value = sep.join(field_value) if isinstance(field_value, list) else field_value
contacts.append('%s: %s' % (title, value))
contacts.append(f'{title}: {value}')
if contacts:
self.api.information('\n'.join(contacts), 'Contact Info')
else:
self.api.information('No Contact Addresses for %s' % iq['from'], 'Error')
self.api.information(f'No Contact Addresses for {iq["from"]}', 'Error')
async def command_disco(self, jid):
try:
iq = await self.core.xmpp.plugin['xep_0030'].get_info(jid=jid, cached=False)
self.on_disco(iq)
except InvalidJID as e:
self.api.information('Invalid JID “%s”: %s' % (jid, e), 'Error')
except InvalidJID as exn:
self.api.information(f'Invalid JID “{jid}”: {exn}', 'Error')
except (IqError, IqTimeout,) as exn:
ifrom = exn.iq['from']
condition = exn.iq['error']['condition']