[英]discord.js rateLimitPerUser is not a function
I'm making a normal discord bot and I wanna set the slowmode here's my full code:我正在制作一个普通的 discord 机器人,我想设置慢速模式,这是我的完整代码:
bot.on("message", message => {
if(message.content.toLowerCase().startsWith(prefix+"slowmode")) {
var str = message.content.split(prefix+"slowmode ");
var num = parseInt(str[1],10);
message.channel.rateLimitPerUser == rts;
message.channel.send("Slowmode Setted");
}
}); });
but I get a error:但我得到一个错误:
TypeError: message.channel.rateLimitPerUser is not a function
I also tried other ways like:我还尝试了其他方法,例如:
message.channel.rateLimitPerUser = num;
but they didn't work too.但他们也没有工作。 I searched the documentary and internet to set the slowmode but they didn't work too.我搜索了纪录片和互联网以设置慢速模式,但它们也不起作用。 [ sorry form my bad english:( ] [对不起,我的英语不好:(]
You need use .setRateLimitPerUser
你需要使用.setRateLimitPerUser
if (message.content.toLowerCase().startsWith(prefix + 'slowmode')) {
var str = message.content.split(prefix + 'slowmode ');
var num = parseInt(str[1], 10);
message.channel.setRateLimitPerUser(num).then(() => {
message.channel.send(`Slowmode Setted to ${num}s. :thumbsup:`);
});
}
client.on("message", (message) => {
let modchannel = db.fetch(`verify_${message.guild.id}`);
var sChannel = message.guild.channels.cache.get(modchannel)
if (!sChannel) return
message.sChannel.setRateLimitPerUser(5);
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.