質問編集履歴
2
change;message
title
CHANGED
File without changes
|
body
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
}
|
16
16
|
});
|
17
17
|
|
18
|
-
としたとき、ユーザーがtestと送信し、test is sent がコンソールに表示され、2回目にtestと送信しても、ifに引っかからずにしたいので、常
|
18
|
+
としたとき、ユーザーがtestと送信し、test is sent がコンソールに表示され、2回目にtestと送信しても、ifに引っかからずにしたいので、常駐するclient.on()のメッセージの受け取りを停止したいという意味です。
|
19
19
|
|
20
20
|
|
21
21
|
|
1
追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
-----日本語-----
|
2
|
-
|
3
1
|
discord.jsを使ったdiscord botについて質問です。
|
4
2
|
|
5
3
|
const client = new Discord.Client();
|
@@ -9,8 +7,20 @@
|
|
9
7
|
この形式でメッセージを取得する際、
|
10
8
|
メッセージ取得(client.on)を停止する方法またはコマンドはありますか?
|
11
9
|
|
12
|
-
-----
|
10
|
+
-------追記-------
|
11
|
+
returnによる1回だけ停止するのではなく、たとえば
|
12
|
+
client.on('message', message => {
|
13
|
+
if(message.content === 'test'){
|
14
|
+
console.log("test is sent")
|
15
|
+
}
|
16
|
+
});
|
13
17
|
|
18
|
+
としたとき、ユーザーがtestと送信し、test is sent がコンソールに表示され、2回目にtestと送信しても、ifに引っかからずにしたいので、常に常駐するclient.on()のメッセージの受け取りを停止したいという意味です。
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
-----------------------English------------------
|
23
|
+
|
14
24
|
I have a question about "discord bot" with "discord.js".
|
15
25
|
|
16
26
|
const client = new Discord.Client();
|
@@ -18,4 +28,14 @@
|
|
18
28
|
client.on('message', message => {});
|
19
29
|
|
20
30
|
When retrieving messages in this format,
|
21
|
-
Is there a way or command to stop message retrieval(client.on)?
|
31
|
+
Is there a way or command to stop message retrieval(client.on)?
|
32
|
+
|
33
|
+
------addition------
|
34
|
+
nstead of stopping only once by return, for example
|
35
|
+
client.on('message', message => {
|
36
|
+
if(message.content === 'test'){
|
37
|
+
console.log("test is sent")
|
38
|
+
}
|
39
|
+
});
|
40
|
+
|
41
|
+
If the user sends "test" and "test is sent" is displayed in the console, and the user sends "test" a second time, we don't want to get caught in the if, which means we want to stop the always resident client.on() from receiving the message.
|