我正在尝试创建服务器中每个成员的列表
let { guild } = message
Object.values(guild.members).forEach(user => {
if (user.nickname) console.log(user.nickname.join('\n'))
})
所有返回的内容都是不确定的。如何生成具有昵称的每个成员的列表,然后将其存储到数组中?
答案 0 :(得分:1)
这应该有效:
const members = message.guild.members.cache;
const membersWithNames = members.filter(e => e.nickname).array();
const onlyNames = membersWithNames.map(e => e.nickname);
答案 1 :(得分:1)
您之所以得到import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
@Component({
selector: 'app-home',
templateUrl: './home.component.html',
styleUrls: ['./home.component.css']
})
export class HomeComponent implements OnInit {
getListData: boolean = false;
constructor(private router: Router) { }
ngOnInit() {
}
clickhere(){
this.getListData = true;
console.log(this.getListData);
setTimeout(function(){
if(this.getListData == true){
alert('true');
}
}, 3000);
}
}
,是因为您需要使用undefined
来访问公会的会员集
您需要通过检查会员的昵称是否与会员的用户名相同来过滤公会的会员集合
cache