我正在为不和谐而创建一个机器人,我试图在多个地方创建一个能够扮演角色的命令,但我不太了解
git log -S"my expression" aBranch
输入此代码会告诉我“公会未定义” 如果您能帮助我,我将不胜感激
答案 0 :(得分:0)
您必须定义行会才能在其上调用方法。您可以通过以下几种方式来定义公会并创建角色
const Discord = require('discord.js');
const client = new Discord.Client();
client.on('message', (message) => {
let guild = message.guild;
guild.createRole(...) ///put in your data here
.then(role => console.log(`Created new role with name ${role.name}`)) //What to do when it has been created
.catch(console.error); //Handle an error
}
const Discord = require('discord.js');
const client = new Discord.Client();
client.on("ready", () => {
let guild = client.guilds.get("GUILD-ID"); //Replace "GUILD-ID" with the id of the guild you want
guild.createRole(...) ///put in your data here
.then(role => console.log(`Created new role with name ${role.name}`)) //What to do when it has been created
.catch(console.error); //Handle an error
}