mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-16 14:11:50 +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 { LogType } from "../../../data/LogType";
|
||||||
import moment from "moment-timezone";
|
import moment from "moment-timezone";
|
||||||
import { GuildPluginData } from "knub";
|
import { GuildPluginData } from "knub";
|
||||||
import { LogsPluginType } from "../types";
|
import { FORMAT_NO_TIMESTAMP, LogsPluginType } from "../types";
|
||||||
import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin";
|
import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin";
|
||||||
|
|
||||||
export async function onMessageDelete(pluginData: GuildPluginData<LogsPluginType>, savedMessage: SavedMessage) {
|
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(
|
pluginData.state.guildLogs.log(
|
||||||
LogType.MESSAGE_DELETE,
|
LogType.MESSAGE_DELETE,
|
||||||
{
|
{
|
||||||
|
@ -27,7 +32,7 @@ export async function onMessageDelete(pluginData: GuildPluginData<LogsPluginType
|
||||||
messageDate: pluginData
|
messageDate: pluginData
|
||||||
.getPlugin(TimeAndDatePlugin)
|
.getPlugin(TimeAndDatePlugin)
|
||||||
.inGuildTz(moment.utc(savedMessage.data.timestamp, "x"))
|
.inGuildTz(moment.utc(savedMessage.data.timestamp, "x"))
|
||||||
.format(pluginData.config.get().format.timestamp),
|
.format(timestampFormat),
|
||||||
message: savedMessage,
|
message: savedMessage,
|
||||||
},
|
},
|
||||||
savedMessage.id,
|
savedMessage.id,
|
||||||
|
|
Loading…
Add table
Reference in a new issue