Be smarter about printing out information to IRC

pull/1/head
Mark Veidemanis 3 years ago
parent 823c495143
commit ef9e958467
Signed by: m
GPG Key ID: 5ACFCEED46C0904F

@ -80,7 +80,23 @@ class IRCBot(irc.IRCClient):
elif cmd == "trades" and host in self.admins:
trades = self.agora.dashboard()
self.msg(channel, dumps(trades))
for trade_id in trades:
fmt = (
f"{trade_id}: {trades[trade_id]['buyer']} "
f"{trades[trade_id]['amount']}{trades[trade_id]['currency']} {trades[trade_id]['amount_xmr']}XMR"
)
self.msg(channel, fmt)
elif cmd == "create" and host in self.admins and len(spl) == 3:
posted = self.agora.create_ad(spl[1], spl[2])
self.msg(channel, dumps(posted))
elif cmd == "messages" and host in self.admins and len(spl) == 1:
messages = self.agora.get_all_messages()
for message_id in messages:
for message in messages[message_id]:
self.msg(channel, f"{message_id}: {message}")
# self.msg(channel, dumps(messages))
def stopcall(self, call):
call.stop()

Loading…
Cancel
Save