mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 12:25:02 +00:00
Add support for server-specific timezone and date format settings
This commit is contained in:
parent
ddbbc543c2
commit
c67a1df11d
51 changed files with 326 additions and 168 deletions
|
@ -4,6 +4,8 @@ import { isOwner, sendErrorMessage } from "src/pluginUtils";
|
|||
import { confirm, SECONDS, noop } from "src/utils";
|
||||
import moment from "moment-timezone";
|
||||
import { rehostAttachment } from "../rehostAttachment";
|
||||
import { inGuildTz } from "../../../utils/timezones";
|
||||
import { getDateFormat } from "../../../utils/dateFormats";
|
||||
|
||||
const MAX_ARCHIVED_MESSAGES = 5000;
|
||||
const MAX_MESSAGES_PER_FETCH = 100;
|
||||
|
@ -96,7 +98,7 @@ export const ArchiveChannelCmd = channelArchiverCmd({
|
|||
|
||||
archiveLines.reverse();
|
||||
|
||||
const nowTs = moment().format("YYYY-MM-DD HH:mm:ss");
|
||||
const nowTs = inGuildTz(pluginData).format(getDateFormat(pluginData, "pretty_datetime"));
|
||||
|
||||
let result = `Archived ${archiveLines.length} messages from #${args.channel.name} at ${nowTs}`;
|
||||
result += `\n\n${archiveLines.join("\n")}\n`;
|
||||
|
@ -104,7 +106,7 @@ export const ArchiveChannelCmd = channelArchiverCmd({
|
|||
progressMsg.delete().catch(noop);
|
||||
msg.channel.createMessage("Archive created!", {
|
||||
file: Buffer.from(result),
|
||||
name: `archive-${args.channel.name}-${moment().format("YYYY-MM-DD-HH-mm-ss")}.txt`,
|
||||
name: `archive-${args.channel.name}-${moment.utc().format("YYYY-MM-DD-HH-mm-ss")}.txt`,
|
||||
});
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue