29 lines
764 B
TypeScript
29 lines
764 B
TypeScript
import { genContextManually } from "../utils/genContext"
|
|
|
|
/**
|
|
* 获取当前的排班文本
|
|
* @returns {string} 排班文本
|
|
*/
|
|
const getScheduleStatus = () => {
|
|
const anchorTime = new Date("2023/03/20")
|
|
const now = new Date()
|
|
const diffTime = Math.floor(((now as any) - (anchorTime as any)) / 86400000)
|
|
const scheduleMap = ["休班", "白班", "白班", "夜班", "夜班", "休班"]
|
|
return scheduleMap[diffTime % 6]
|
|
}
|
|
|
|
/**
|
|
* 发送钟哥的排班通知
|
|
* @returns {Promise<void>}
|
|
*/
|
|
const sendZhongNotify = async () => {
|
|
const ctx = await genContextManually()
|
|
const status = getScheduleStatus()
|
|
await ctx.larkService.message.sendText2Chat(
|
|
ctx.appInfo.errChatId,
|
|
`钟哥今天是${status}哦~`
|
|
)
|
|
}
|
|
|
|
export default sendZhongNotify
|