diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2017-01-06 16:11:34 +0100 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2017-01-06 16:11:34 +0100 |
| commit | f436b6d27fb1cf013d82ec98a5821f7c3b21c1d6 (patch) | |
| tree | 94d30f605ccd7d1f835317ef65b1cb62d4dea1e3 | |
| parent | 095e07cd30929186199a7b19bf97a771f7e36a9d (diff) | |
| download | Vainbot-f436b6d27fb1cf013d82ec98a5821f7c3b21c1d6.tar.gz Vainbot-f436b6d27fb1cf013d82ec98a5821f7c3b21c1d6.zip | |
use different interface to bot logs
| -rw-r--r-- | main.py | 30 |
1 files changed, 26 insertions, 4 deletions
@@ -105,15 +105,37 @@ async def search_teammates(server, channel, who, query, notify=True): @cli.event async def on_message_delete(message): + msgs = [] mirror = cli.get_channel(MODMIRROR) - if message.author != cli.user and mirror and message.channel.id not in MIRROR_IGNORE: - await cli.send_message(mirror, message.author.mention + message.channel.mention + ": DELETE: " + message.content) + msgs.append("--- deleted message " + message.author.mention + message.channel.mention) + ms = [] + async for m in cli.logs_from(message.channel, limit=4, before=message): + ms.append(m) + for m in reversed(ms): + msgs.append(m.author.mention + m.channel.mention + ": " + m.content) + msgs.append(" > " + message.author.mention + message.channel.mention + " ~~" + message.content + "~~") + async for m in cli.logs_from(message.channel, limit=2, after=message): + msgs.append(m.author.mention + m.channel.mention + ": " + m.contet) + msgs.append("---") + text = "\n".join(msgs) + await cli.send_message(mirror, text) @cli.event async def on_message_edit(before, message): + msgs = [] mirror = cli.get_channel(MODMIRROR) - if message.author != cli.user and mirror and message.channel.id not in MIRROR_IGNORE: - await cli.send_message(mirror, message.author.mention + message.channel.mention + ": EDIT: ~~" + before.content + "~~ -> " + message.content) + msgs.append("--- edited message " + message.author.mention + message.channel.mention) + ms = [] + async for m in cli.logs_from(message.channel, limit=4, before=message): + ms.append(m) + for m in reversed(ms): + msgs.append(m.author.mention + m.channel.mention + ": " + m.content) + msgs.append(" > " + message.author.mention + message.channel.mention + " ~~" + before.content + "~~ " + message.content) + async for m in cli.logs_from(message.channel, limit=2, after=message): + msgs.append(m.author.mention + m.channel.mention + ": " + m.contet) + msgs.append("---") + text = "\n".join(msgs) + await cli.send_message(mirror, text) @cli.event async def on_message(message): |
