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

Commit

Permalink
fix : fixEmoji function에서 undefined를 입력으로 받았을 때 생기는 에러처리
Browse files Browse the repository at this point in the history
  • Loading branch information
ekgns33 committed Oct 24, 2023
1 parent a161619 commit 6005396
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ interface Updates {
}
const emojis: Array<Emojis> = [];

const incEmojis = emojiInc.split(',').map((emoji) => emoji.trim());
incEmojis.forEach((emoji: string) => emojis.push({ type: 'inc', emoji }));
if (emojiInc) {
const incEmojis = emojiInc.split(',').map((emoji) => emoji.trim());
incEmojis.forEach((emoji: string) => emojis.push({ type: 'inc', emoji }));
}

if (!disableEmojiDec) {
if (!disableEmojiDec && emojiDec) {
const decEmojis = emojiDec.split(',').map((emoji) => emoji.trim());
decEmojis.forEach((emoji: string) => emojis.push({ type: 'dec', emoji }));
}
Expand Down
3 changes: 2 additions & 1 deletion src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ const isFalse = (input: string) =>
const isTrue = (input: string) =>
input === 'true' || input === 'yes' || input === '1';

export function fixEmoji(input) {
export function fixEmoji(input): string {
if (!input) return '';
let inputFix = input;
if (!input.startsWith(':')) inputFix = `:${inputFix}`;
if (!input.endsWith(':')) inputFix = `${inputFix}:`;
Expand Down

0 comments on commit 6005396

Please sign in to comment.