Toggle navigation
Toggle navigation
This project
Loading...
Sign in
김건우
/
studyChatBot
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
김건우
2021-12-08 21:45:08 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
8428aad64423679c33821c284fc2ca1e9fcfa8b9
8428aad6
1 parent
2b56dfb8
Fix not to enter incorrect date
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletions
app.js
app.js
View file @
8428aad
...
...
@@ -4,7 +4,7 @@ const {MessageEmbed} = require('discord.js');
const
client
=
new
Discord
.
Client
()
const
fs
=
require
(
'fs'
);
const
internal
=
require
(
"stream"
);
var
now
=
new
Date
();
const
now
=
new
Date
();
const
moment
=
require
(
'moment'
)
const
Youtube
=
require
(
'simple-youtube-api'
);
const
youtube
=
new
Youtube
(
youtubeAPI
);
...
...
@@ -254,6 +254,7 @@ client.on("message", msg => {
var
dDayData
=
msg
.
toString
().
split
(
" "
);
var
dDayTitle
=
dDayData
[
1
];
var
dDayWhen
=
dDayData
[
2
].
toString
().
split
(
'/'
);
if
(
moment
(
String
(
now
.
getFullYear
())
+
"-"
+
dDayWhen
[
0
]
+
"-"
+
dDayWhen
[
1
]
,
'YYYY-MM-DD'
).
isValid
())
{
var
fileName
=
"data/dDay/"
+
msg
.
channel
.
id
+
"/"
+
dDayTitle
+
".txt"
;
makeFolder
(
"./data/dDay/"
+
msg
.
channel
.
id
);
fs
.
writeFileSync
(
fileName
,
dDayData
[
2
],
'utf8'
,
function
(
error
){
// 파일에 data내용 저장
...
...
@@ -261,6 +262,9 @@ client.on("message", msg => {
});
console
.
log
(
dDayWhen
[
0
]
+
"월 "
+
dDayWhen
[
1
]
+
"일에 "
+
dDayTitle
+
"이(가) 설정되었습니다."
);
msg
.
reply
(
dDayWhen
[
0
]
+
"월 "
+
dDayWhen
[
1
]
+
"일에 "
+
dDayTitle
+
"이(가) 설정되었습니다."
);
}
else
{
msg
.
reply
(
"잘못된 날짜를 입력하였어요."
);
}
}
catch
{
msg
.
reply
(
"양식이 올바르지 않아요. 예) "
+
prefix
+
"디데이설정 기말고사 12/15"
);
...
...
@@ -293,6 +297,7 @@ client.on("message", msg => {
}
else
{
msg
.
channel
.
send
(
el
.
replace
(
'.txt'
,
''
)
+
"까지 D - day"
);
//dDay 답장 (오늘인경우)
console
.
log
(
dDayPrint
,
t1
,
t2
);
}
});
...
...
Please
register
or
login
to post a comment