Skip to content

Commit

Permalink
Merge pull request #272 from patrickmonster/release/3.5.5
Browse files Browse the repository at this point in the history
Release. 3.5.5
  • Loading branch information
patrickmonster authored Jul 18, 2024
2 parents 2dcce8f + d6aba15 commit 0cb86c2
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"tabWidth": 4
},
"name": "discord-notification-ts",
"version": "3.5.4",
"version": "3.5.5",
"main": "index.js",
"repository": "https://github.com/patrickmonster/discord-notification-ts.git",
"author": "Soung jin Ryu <neocat@kakao.com>",
Expand Down
6 changes: 2 additions & 4 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { fork } from 'child_process';
import { close, serverSideEmit } from 'components/socket/socketServer';
import { createECSState } from 'utils/ECS';
import 'utils/procesTuning';
import { addServerRequest, bootTime } from 'utils/serverState';
import { addServerRequest } from 'utils/serverState';

const server = fastify({
// logger: env.NODE_ENV != 'prod'
Expand Down Expand Up @@ -60,9 +60,7 @@ server.listen({ port: 3000, host: '::' }, (err, address) => {
console.error(err);
process.exit(1);
}

const time = Date.now() - bootTime;
console.log(`Server started in ${Math.floor(time / 1000)} (${time}ms)`);
console.log(`Server started in ${process.uptime()}s`);
console.log(`Server listening at ${address}`);
});

Expand Down
4 changes: 2 additions & 2 deletions src/components/notice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ export const sendMessageByChannels = async (channels: NoticeChannelHook[], isTes
switch (channel_type) {
case ChannelMessageType.TEXT:
originMessage = await messageCreate(channel_id, message).catch(e => {
if ([10003 /* , 50013 */].includes(e.code)) {
if ([10003, 50001 /* , 50013 */].includes(e.code)) {
deleteNoticeChannel(notice_id, channel_id).catch(e => {
ERROR('DeleteChannel', e);
});
Expand All @@ -194,7 +194,7 @@ export const sendMessageByChannels = async (channels: NoticeChannelHook[], isTes
// 훅 발송
originMessage = await postDiscordMessage(`/${url}`, message).catch(e => {
ERROR(e);
if ([10003].includes(e.code)) {
if ([10003, 50001].includes(e.code)) {
deleteNoticeChannel(notice_id, channel_id).catch(e => {
ERROR('DeleteChannel', e);
});
Expand Down
4 changes: 2 additions & 2 deletions src/components/user/chzzk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { APIEmbed } from 'discord-api-types/v10';
import qs from 'querystring';

import { messageEdit, messageHookEdit } from 'components/discord';
import { sendChannels, sendMessageByChannels } from 'components/notice';
import { sendMessageByChannels } from 'components/notice';

import { auth } from 'controllers/auth';
import { insertLiveEvents, updateLiveEvents } from 'controllers/bat';
Expand Down Expand Up @@ -286,7 +286,7 @@ export const getChannelLive = async (noticeId: number, hashId: string, liveId: s
* @returns
* @see getChannelLive
* @see convertVideoObject
* @see sendChannels
* @see sendMessageByChannels
*/
export const getLiveMessage = async ({
channels,
Expand Down
22 changes: 20 additions & 2 deletions src/utils/autoCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,12 @@ const util = {
const out: Modules[] = [];

if (files.length === 0) return out;
options?.isLog && console.log('AutoCommand] ScanDir', `[${files.join(', ')}]`);
// options?.isLog &&
// console.log(
// 'AutoCommand]',
// modulePath.replace(process.cwd(), ''),
// `[${files.map(s => `${s}`.replace(/(\.ts|\.js)/, '')).join(', ')}]`
// );

for (const file of files) {
const filePath = join(modulePath, file);
Expand Down Expand Up @@ -119,7 +124,20 @@ export default (
file: i.file,
})); // 트리 직열화

option.isLog && console.log('AutoCommand] Loading commands', `[${modules.map(i => i.name).join(', ')}]`);
const root = modulePath.replace(process.cwd(), '');

option.isLog &&
console.log(
`AutoCommand] ${root}`,
`[\n${modules
.map(
i =>
`\t${i.name}${Array.from({ length: 30 - i.name.length }, (_, i) => ' ').join(
''
)}: ${i.file.replace(modulePath, '')}`
)
.join(',\n ')}\n]`
);

return [modules, list];
};
3 changes: 3 additions & 0 deletions src/utils/procesTuning.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { error as errorLog } from 'utils/logger';

/**
* 해당 프로세서가 종료되는것을 방지하기 위한 처리입니다.
*/
process.on('unhandledRejection', (err, promise) => {
errorLog('unhandledRejection', JSON.stringify(err, Object.getOwnPropertyNames(err)));
console.error('unhandledRejection', err);
Expand Down

0 comments on commit 0cb86c2

Please sign in to comment.