前提・実現したいこと
Discord botでmusicチャンネルの入退室を検知して
チャンネル名で指定しそこにlogとして送信するもの。
現在のコード
js
1const Eris = require("eris"); 2 3var bot = new Eris("botのtoken"); 4 5bot.on("ready", ()=>{ 6 console.log("Ready!"); 7}); 8 9bot.on("voiceChannelJoin", (member, newChannel) => { 10 let ch = newChannel.guild.defaultChannel; 11 bot.createMessage('Channel ID',{embed: { 12 title:'voice log', 13 color:'131379', 14 description:`${member.username} が ${newChannel.name} に入室しました。`, 15}})}); 16 17bot.on("voiceChannelLeave", (member, oldChannel) => { 18 let ch = oldChannel.guild.defaultChannel; 19 bot.createMessage('Channel ID',{embed: { 20 title: 'voice log', 21 color:'131379', 22 description:` ${member.username} が ${oldChannel.name} から退出しました。`, 23}})}); 24 25bot.on("voiceChannelSwitch", (member, newChannel, oldChannel) => { 26 let ch = oldChannel.guild.defaultChannel; 27 bot.createMessage('Channel ID',{embed: { 28 title: 'voice log', 29 color: '131379', 30 description:` ${member.username} が ${oldChannel.name} から ${newChannel.name} に移動しました。`, 31}})}); 32 33// Discord に接続します。 34bot.connect();
###どのようにしたいか
上記のコードのように、Channel IDで指定しそこに送信するようにしているのですが 、
それだと他のサーバーのlogもそこに流れてしまい、Channel名(例:music log)のような
チャンネルを作成するとそこにlogが流れるようにしたいです。
分かる方そのコードを教えてくれると嬉しいです。
よろしくお願いします。
補足
Discord.jsを利用しておりツール?はerisです。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。