mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-15 05:41:51 +00:00
logs: fix weird timestamp on message deletion
This commit is contained in:
parent
dda4313b26
commit
453ca0808e
1 changed files with 7 additions and 2 deletions
|
@ -4,7 +4,7 @@ import { useMediaUrls, stripObjectToScalars, resolveUser } from "../../../utils"
|
|||
import { LogType } from "../../../data/LogType";
|
||||
import moment from "moment-timezone";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { LogsPluginType } from "../types";
|
||||
import { FORMAT_NO_TIMESTAMP, LogsPluginType } from "../types";
|
||||
import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin";
|
||||
|
||||
export async function onMessageDelete(pluginData: GuildPluginData<LogsPluginType>, savedMessage: SavedMessage) {
|
||||
|
@ -19,6 +19,11 @@ export async function onMessageDelete(pluginData: GuildPluginData<LogsPluginType
|
|||
}
|
||||
}
|
||||
|
||||
// See comment on FORMAT_NO_TIMESTAMP in types.ts
|
||||
const config = pluginData.config.get();
|
||||
const timestampFormat =
|
||||
(config.format.timestamp !== FORMAT_NO_TIMESTAMP ? config.format.timestamp : null) ?? config.timestamp_format;
|
||||
|
||||
pluginData.state.guildLogs.log(
|
||||
LogType.MESSAGE_DELETE,
|
||||
{
|
||||
|
@ -27,7 +32,7 @@ export async function onMessageDelete(pluginData: GuildPluginData<LogsPluginType
|
|||
messageDate: pluginData
|
||||
.getPlugin(TimeAndDatePlugin)
|
||||
.inGuildTz(moment.utc(savedMessage.data.timestamp, "x"))
|
||||
.format(pluginData.config.get().format.timestamp),
|
||||
.format(timestampFormat),
|
||||
message: savedMessage,
|
||||
},
|
||||
savedMessage.id,
|
||||
|
|
Loading…
Add table
Reference in a new issue