const token = "your-token-here";
const Discord = require("discord.js");
const client = new Discord.Client();
console.log('Running!!');
client.on("ready", () => {
console.log("I am ready!");
});
client.on("message", (msg) => {
if(msg.content.startsWith("rf!find ")){
var name = msg.content.slice(8);
console.log(`Requested role name: ${name}`);
if (msg.guild === null){
msg.reply("You cannot send commands in a DM");
return;
}
var role = msg.guild.roles.find('name', name);
if(role){
msg.reply(`ID of the role is:`);
msg.channel.send(`\`${role.id}\``);
}else{
msg.reply(`couldn't find role, please note that it is case-sensitive`);
}
}
});
client.login(token);