回答編集履歴
1
間違って途中で送信しちゃいました...不慣れでごめんなさい!
test
CHANGED
@@ -16,6 +16,62 @@
|
|
16
16
|
|
17
17
|
```
|
18
18
|
|
19
|
+
const Eris = require("eris");
|
19
20
|
|
20
21
|
|
22
|
+
|
23
|
+
var bot = new Eris("xxxxxxxxxxxxxxx");
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
bot.on("ready", () => {
|
28
|
+
|
29
|
+
console.log("Ready!");
|
30
|
+
|
31
|
+
console.log(bot.channelGuildMap);
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
});
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
bot.on("voiceChannelJoin", (member, newChannel) => {
|
42
|
+
|
43
|
+
let ch = newChannel.guild.defaultChannel;
|
44
|
+
|
45
|
+
console.log("%s が チャンネル %s に入室しました。", member.username, newChannel.name);
|
46
|
+
|
47
|
+
bot.createMessage('チャンネルID', member.username + "が チャンネル[" + newChannel.name + "] に入室しました。");
|
48
|
+
|
49
|
+
});
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
bot.on("voiceChannelLeave", (member, oldChannel) => {
|
54
|
+
|
55
|
+
let ch = oldChannel.guild.defaultChannel;
|
56
|
+
|
57
|
+
bot.createMessage('チャンネルID', member.username + "が チャンネル[" + oldChannel.name + "] から退出しました。");
|
58
|
+
|
59
|
+
});
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
bot.on("voiceChannelSwitch", (member, newChannel, oldChannel) => {
|
64
|
+
|
65
|
+
let ch = oldChannel.guild.defaultChannel;
|
66
|
+
|
67
|
+
bot.createMessage('チャンネルID', member.username + "が チャンネル[" + oldChannel.name + "] から [" + newChannel.name + "] に移動しました。");
|
68
|
+
|
69
|
+
});
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
// Discord に接続します。
|
74
|
+
|
75
|
+
bot.connect();
|
76
|
+
|
21
77
|
```
|