3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-15 05:41:51 +00:00

Log text/style tweaks; add message date to deletion logs

This commit is contained in:
Dragory 2018-12-22 12:38:52 +02:00
parent 1dd8266405
commit 3c3602f8d3
4 changed files with 11 additions and 9 deletions

View file

@ -10,10 +10,10 @@
"MEMBER_SOFTBAN": "🔨 **{member.user.username}#{member.user.discriminator}** (`{member.id}`) was softbanned by {mod.username}#{mod.discriminator}",
"MEMBER_JOIN": "📥 **{member.user.username}#{member.user.discriminator}** (`{member.id}`) joined{new} (created {account_age} ago)",
"MEMBER_LEAVE": "📤 **{member.user.username}#{member.user.discriminator}** (`{member.id}`) left the server",
"MEMBER_ROLE_ADD": "🔑 **{member.user.username}#{member.user.discriminator}** (`{member.id}`) role added **{role.name}** by {mod.username}#{mod.discriminator}",
"MEMBER_ROLE_REMOVE": "🔑 **{member.user.username}#{member.user.discriminator}** (`{member.id}`) role removed **{role.name}** by {mod.username}#{mod.discriminator}",
"MEMBER_NICK_CHANGE": "✏ **{member.user.username}#{member.user.discriminator}** (`{member.id}`) changed their nickname from **{oldNick}** to **{newNick}**",
"MEMBER_USERNAME_CHANGE": "✏ **{member.user.username}#{member.user.discriminator}** (`{member.id}`) changed their username from **{oldName}** to **{newName}**",
"MEMBER_ROLE_ADD": "🔑 **{member.user.username}#{member.user.discriminator}** (`{member.id}`): role **{role.name}** added by {mod.username}#{mod.discriminator}",
"MEMBER_ROLE_REMOVE": "🔑 **{member.user.username}#{member.user.discriminator}** (`{member.id}`): role **{role.name}** removed by {mod.username}#{mod.discriminator}",
"MEMBER_NICK_CHANGE": "✏ **{member.user.username}#{member.user.discriminator}** (`{member.id}`): nickname changed from **{oldNick}** to **{newNick}**",
"MEMBER_USERNAME_CHANGE": "✏ **{member.user.username}#{member.user.discriminator}** (`{member.id}`): username changed from **{oldName}** to **{newName}**",
"MEMBER_RESTORE": "💿 **{member.user.username}#{member.user.discriminator}** (`{member.id}`) was restored",
"CHANNEL_CREATE": "🖊 Channel **#{channel.name}** was created",
@ -24,8 +24,8 @@
"ROLE_DELETE": "🖊 Role **{role.name}** was deleted",
"ROLE_EDIT": "🖊 Role **{role.name}** was edited",
"MESSAGE_EDIT": "✏ **{member.user.username}#{member.user.discriminator}** (`{member.id}`) message edited in **#{channel.name}**:\nBefore:```{before}```After:```{after}```",
"MESSAGE_DELETE": "🗑 **{member.user.username}#{member.user.discriminator}** (`{member.id}`) message deleted in **#{channel.name}**:\n```{messageText}```{attachments}",
"MESSAGE_EDIT": "✏ **{member.user.username}#{member.user.discriminator}** (`{member.id}`) edited their message in **#{channel.name}**:\nBefore:```{before}```After:```{after}```",
"MESSAGE_DELETE": "🗑 Message from **{member.user.username}#{member.user.discriminator}** (`{member.id}`) deleted in **#{channel.name}** (originally posted at **{messageDate}**):\n```{messageText}```{attachments}",
"MESSAGE_DELETE_BULK": "🗑 **{count}** messages deleted in **#{channel.name}** ({archiveUrl})",
"MESSAGE_DELETE_BARE": "🗑 Message (`{messageId}`) deleted in **#{channel.name}** (no more info available)",

View file

@ -32,7 +32,8 @@ export class GuildSavedMessages extends BaseRepository {
username: msg.author.username,
discriminator: msg.author.discriminator
},
content: msg.content
content: msg.content,
timestamp: msg.timestamp
};
if (msg.attachments.length) data.attachments = msg.attachments;

View file

@ -1,5 +1,4 @@
import { Entity, Column, PrimaryColumn } from "typeorm";
import { Message } from "eris";
export interface ISavedMessageData {
attachments?: object[];
@ -9,6 +8,7 @@ export interface ISavedMessageData {
};
content: string;
embeds?: object[];
timestamp: number;
}
@Entity("messages")

View file

@ -51,7 +51,7 @@ export class LogsPlugin extends Plugin {
config: {
channels: {},
format: {
timestamp: "HH:mm:ss",
timestamp: "YYYY-MM-DD HH:mm:ss",
...DefaultLogMessages
}
}
@ -306,6 +306,7 @@ export class LogsPlugin extends Plugin {
member: stripObjectToScalars(member, ["user"]),
channel: stripObjectToScalars(channel),
messageText: disableCodeBlocks(deactivateMentions(savedMessage.data.content || "<no text content>")),
messageDate: moment(savedMessage.data.timestamp, "x").format(this.configValue("format.timestamp")),
attachments: disableLinkPreviews(useMediaUrls(attachments))
},
savedMessage.id