discord.js如何获取公会的数字会员

时间:2020-05-26 09:02:27

标签: javascript discord discord.js

"extra": { "connectionLimit": 5 }

我如何检查行会中的人数成员?

discord.js version 12

2 个答案:

答案 0 :(得分:0)

if(message.content === 'numberguild'){
  message.channel.send((client.guilds.cache.get(message.guild.id).memberCount))
}

or 

const a = (client.guilds.cache.get(message.guild.id).memberCount)
if(message.content === 'numberguild'){
  message.channel.send(a + " members")
}

答案 1 :(得分:0)

struct TestListView: View { @State var strings = [ "Foo", "Bar", "Buzz", ] var body: some View { List(strings.indices) { index in NavigationLink(destination: TestDetailView(selectedString: self.$strings[index])) { Text(self.strings[index]) } } } } struct TestDetailView: View { @Binding var selectedString: String // remove optional var body: some View { VStack { TextField("Placeholder", text: $selectedString) .padding() .textFieldStyle(RoundedBorderTextFieldStyle()) Spacer() } } } 的内容更改为message.channel.send()

还要在message.guild.memberCount之后的.includes()内将'numberguild'移到message.content内,以免在您不想执行该命令时使用。

固定代码:

if(message.content.includes('numberguild')){ message.channel.send(message.guild.memberCount) }