1
내 코드 // 작동하지 않는 것은 현재 : 사용자가 역할을역할 전용 명령 Discord.js
if (message.content == ",test") {
if (message.member.roles.find("name", "images")) {
message.channel.send({
file: "http://www.drodd.com/images14/black11.jpg" // Or replace with FileOptions object
});
}
if (!message.member.roles.find("name", "images")) { // This checks to see if they DONT have it, the "!" inverts the true/false
message.reply('You need the \`images\` role to use this command.')
.then(msg => {
msg.delete(5000)
})
}
message.delete(100); //Supposed to delete message
return; // this returns the code, so the rest doesn't run.
}
경우 '이미지'나는 그들이 말하는 이미지를 보낼 수있는 로봇을 원한다 "테스트"와 몇 초 후에 사용자의 ", 테스트"메시지를 삭제하고 싶습니다. 그러나 이것은 작동하지 않는 것 같습니다.
역할 검사를하지 않고 이미지를 보내려고했는데 성공했습니다.
어떻게 해결할 수 있습니까?
안녕하세요, 답장을 보내 주셔서 감사합니다. 나는 그것을 시도하고 그것은 작동하지 않았다. 다음은 콘솔 오류입니다 :'TypeError : message.guild.roles.find (...). id.catch는 함수가 아닙니다'http://prntscr.com/hrg72k –
그리고 코드 : https : // pastebin. co.kr/raw/57a8s7GR –
문제가 발생할 수있는 캐치를 제거했습니다. – Axium