echo_bot: use f-strings where possible
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
parent
31380cd726
commit
a495d7d7c8
1 changed files with 8 additions and 8 deletions
|
@ -101,9 +101,9 @@ class EchoBot(ClientXMPP):
|
|||
body = (
|
||||
'I\'m the slixmpp-omemo echo bot! '
|
||||
'The following commands are available:\n'
|
||||
'{prefix}verbose Send message or reply with log messages\n'
|
||||
'{prefix}error Send message or reply only on error\n'
|
||||
).format(prefix=self.cmd_prefix)
|
||||
f'{self.cmd_prefix}verbose Send message or reply with log messages\n'
|
||||
f'{self.cmd_prefix}error Send message or reply only on error\n'
|
||||
)
|
||||
return await self.encrypted_reply(mto, mtype, body)
|
||||
|
||||
async def cmd_verbose(self, mto: JID, mtype: str) -> None:
|
||||
|
@ -136,7 +136,7 @@ class EchoBot(ClientXMPP):
|
|||
|
||||
if not self['xep_0384'].is_encrypted(msg):
|
||||
if self.debug_level == LEVEL_DEBUG:
|
||||
await self.plain_reply(mto, mtype, 'Echo unencrypted message:%(body)s' % msg)
|
||||
await self.plain_reply(mto, mtype, f"Echo unencrypted message:{msg['body']}")
|
||||
return None
|
||||
|
||||
try:
|
||||
|
@ -151,7 +151,7 @@ class EchoBot(ClientXMPP):
|
|||
if self.is_command(decoded):
|
||||
await self.handle_command(mto, mtype, decoded)
|
||||
elif self.debug_level == LEVEL_DEBUG:
|
||||
await self.encrypted_reply(mto, mtype, 'Echo: %s' % decoded)
|
||||
await self.encrypted_reply(mto, mtype, f'Echo: {decoded}')
|
||||
return None
|
||||
except (MissingOwnKey,):
|
||||
# The message is missing our own key, it was not encrypted for
|
||||
|
@ -185,7 +185,7 @@ class EchoBot(ClientXMPP):
|
|||
# anyway.
|
||||
await self.plain_reply(
|
||||
mto, mtype,
|
||||
"Error: Your device '%s' is not in my trusted devices." % exn.device,
|
||||
f"Error: Your device '{exn.device}' is not in my trusted devices.",
|
||||
)
|
||||
# We resend, setting the `allow_untrusted` parameter to True.
|
||||
await self.message_handler(msg, allow_untrusted=True)
|
||||
|
@ -260,8 +260,8 @@ class EchoBot(ClientXMPP):
|
|||
# point can bring up the issue if it happens.
|
||||
self.plain_reply(
|
||||
mto, mtype,
|
||||
'Could not find keys for device "%d" of recipient "%s". Skipping.' %
|
||||
(error.device, error.bare_jid),
|
||||
f'Could not find keys for device "{error.device}"'
|
||||
f' of recipient "{error.bare_jid}". Skipping.',
|
||||
)
|
||||
jid = JID(error.bare_jid)
|
||||
device_list = expect_problems.setdefault(jid, [])
|
||||
|
|
Loading…
Reference in a new issue