Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

Commit

Permalink
fix #64 footerにタイムスタンプを表示するように修正
Browse files Browse the repository at this point in the history
  • Loading branch information
yogarasu committed Sep 20, 2022
1 parent d7354db commit 82d82cc
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions libs/message.mts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { PrismaClient, Message, User } from "@prisma/client"
import { access, readFile, constants, readdir } from "node:fs/promises"
import { statSync } from "node:fs"
import { join } from "node:path"
import { formatISO, fromUnixTime } from "date-fns"
import { format, formatISO, fromUnixTime } from "date-fns"
import { WebClient as SlackClient } from "@slack/web-api"
import { FileElement } from "@slack/web-api/dist/response/ChatPostMessageResponse"
import { ChannelType, EmbedType } from "discord.js"
Expand Down Expand Up @@ -226,7 +226,7 @@ export class MessageClient {
maxFileSize: 8000000 | 50000000 | 100000000
) {
// Get post timestamp of message
const timestamp = formatISO(fromUnixTime(parseFloat(message.timestamp)))
const timestamp = fromUnixTime(parseFloat(message.timestamp))

let authorTypeIcon: "🟢" | "🔵" | "🤖" = "🟢"
if (message.authorType === 2) authorTypeIcon = "🔵"
Expand All @@ -248,11 +248,14 @@ export class MessageClient {
type: EmbedType.Rich,
color: message.authorColor,
description: content,
timestamp: timestamp,
timestamp: formatISO(timestamp),
author: {
name: `${authorTypeIcon} ${message.authorName}`,
icon_url: message.authorImageUrl,
},
footer: {
text: format(timestamp, "yyyy/MM/dd HH:mm"),
},
},
]

Expand Down

0 comments on commit 82d82cc

Please sign in to comment.