Post message to IRC if there are no trades/messages

This commit is contained in:
Mark Veidemanis 2021-12-28 11:31:15 +00:00
parent 2f274390a8
commit 9991813209
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
1 changed files with 4 additions and 0 deletions

View File

@ -78,6 +78,8 @@ class IRCBot(irc.IRCClient):
elif cmd == "messages" and host in self.admins and len(spl) == 1: elif cmd == "messages" and host in self.admins and len(spl) == 1:
# Get all messages for all open trades # Get all messages for all open trades
messages = self.agora.get_all_messages() messages = self.agora.get_all_messages()
if not messages:
self.msg(channel, "No messages.")
for message_id in messages: for message_id in messages:
for message in messages[message_id]: for message in messages[message_id]:
self.msg(channel, f"{message_id}: {message}") self.msg(channel, f"{message_id}: {message}")
@ -87,6 +89,8 @@ class IRCBot(irc.IRCClient):
elif cmd == "messages" and host in self.admins and len(spl) == 2: elif cmd == "messages" and host in self.admins and len(spl) == 2:
# Get all messages for a given trade # Get all messages for a given trade
messages = self.agora.get_messages(spl[1], send_irc=False) messages = self.agora.get_messages(spl[1], send_irc=False)
if not messages:
self.msg(channel, "No messages.")
for message in messages: for message in messages:
self.msg(channel, f"{spl[1]}: {message}") self.msg(channel, f"{spl[1]}: {message}")