GuildMember.from constructor
GuildMember.from({
- required dynamic user,
- required GuildRoleManager roles,
- required Guild guild,
- required dynamic member,
- required VoiceManager voice,
Implementation
factory GuildMember.from({ required user, required GuildRoleManager roles, required Guild guild, required dynamic member, required VoiceManager voice }) {
MemberRoleManager memberRoleManager = MemberRoleManager(manager: roles, memberId: user.id);
for (var element in (member['roles'] as List<dynamic>)) {
Role? role = roles.cache.get(element);
if (role != null) {
memberRoleManager.cache.putIfAbsent(role.id, () => role);
}
}
return GuildMember(
user,
member['nick'],
member['avatar'],
DateTime.parse(member['joined_at']),
member['premium_since'],
member['permissions'],
member['pending'] == true,
member['communication_disabled_until'],
memberRoleManager,
voice,
guild,
null,
);
}