Toggle navigation
Toggle navigation
This project
Loading...
Sign in
오수한
/
discord_chatbot
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
오수한
2022-05-29 22:06:26 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
f9b656661061dfd06da3043a47ea15c7628ca1ca
f9b65666
1 parent
dcb0c676
Add Reaction CONSOLE
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
0 deletions
index.js
index.js
View file @
f9b6566
...
...
@@ -2,6 +2,12 @@ const Discord = require('discord.js'); // discord.js 라이브러리 호출
const
client
=
new
Discord
.
Client
({
intents
:
[
"GUILDS"
,
"GUILD_MESSAGES"
]
})
// Client 객체 생성
const
{
token
}
=
require
(
'./token'
);
client
.
on
(
'messageReactionAdd'
,
(
msg
,
user
)
=>
{
// messageReactionAdd : 메시지의 Reaction이 추가되었을 때의 이벤트
let
Ddabong
=
(
msg
.
emoji
.
name
==
'👍'
)
?
'따봉'
:
'아님'
;
console
.
log
(
`emoji
${
Ddabong
}
, test :
${
msg
.
emoji
.
name
}
`
);
});
// discord 봇이 실행될 때 딱 한 번 실행할 코드를 적는 부분
client
.
on
(
'ready'
,
()
=>
{
console
.
log
(
`Logged in as
${
client
.
user
.
tag
}
!`
);
...
...
@@ -42,6 +48,10 @@ client.on('message', msg => {
const
emoji
=
new
Discord
.
MessageAttachment
(
'https://mblogthumb-phinf.pstatic.net/MjAyMDAyMDdfMTIg/MDAxNTgxMDAxMzg4NjQy.7MnAhfaDgkJpAJSmDdsookDH5Y7MGZ-nEJfisPQ8pFYg.HVgBCWquHnWcmbBvc1RwBTgVt8xL6lmx8CU0EqVXyYAg.PNG.azzi_01/_02.png?type=w800'
)
msg
.
channel
.
send
(
emoji
);
}
app
.
on
(
'messageReactionAdd'
,
(
msg
,
user
)
=>
{
// messageReactionAdd : 메시지의 Reaction이 추가되었을 때의 이벤트
let
Ddabong
=
(
msg
.
emoji
.
name
==
'👍'
)
?
'따봉'
:
'아님'
;
console
.
log
(
`emoji
${
Ddabong
}
, test :
${
msg
.
emoji
.
name
}
`
);
});
//console.log(msg.author); 사용자 정보가 발생합니다.
}
catch
(
e
)
{
...
...
Please
register
or
login
to post a comment