自动分配角色加入用户 Discord.net
Auto assigning roles Joined user Discord.net
我正在尝试在 Discord 服务器中添加自动角色化的新成员,
例如,我使用的是 Discord 1.0.1
role Name : (Test) / Role ID : (5246771013.....)
所以,我尝试了 2 种方法,name
和 id
的作用。 None 其中有效。
Private Async Function userJoined(user As SocketGuildUser) As Task
' Welcome message can work good
' time to test auto roled member's while join my server/ let me try with auto roled by ID.
Dim Role_ID As ULong = 5246771013.....'- Method auto role by ID
'Dim Role_Name As IGuildUser = "test" '- Method auto role by name
Await user.Guild.CurrentUser.Guild.Roles(Role_ID)
End Function
但效果不佳。有什么建议吗?
按 ID :
Dim role = (CType(channell, ITextChannel)).Guild.GetRole(5246771013.....)
按姓名:
Dim role = (CType(channell, ITextChannel)).Guild.Roles.FirstOrDefault(Function(x) x.Name = "test")
然后
Await (CType(user, SocketGuildUser)).AddRoleAsync(role)
我正在尝试在 Discord 服务器中添加自动角色化的新成员,
例如,我使用的是 Discord 1.0.1
role Name : (Test) / Role ID : (5246771013.....)
所以,我尝试了 2 种方法,name
和 id
的作用。 None 其中有效。
Private Async Function userJoined(user As SocketGuildUser) As Task
' Welcome message can work good
' time to test auto roled member's while join my server/ let me try with auto roled by ID.
Dim Role_ID As ULong = 5246771013.....'- Method auto role by ID
'Dim Role_Name As IGuildUser = "test" '- Method auto role by name
Await user.Guild.CurrentUser.Guild.Roles(Role_ID)
End Function
但效果不佳。有什么建议吗?
按 ID :
Dim role = (CType(channell, ITextChannel)).Guild.GetRole(5246771013.....)
按姓名:
Dim role = (CType(channell, ITextChannel)).Guild.Roles.FirstOrDefault(Function(x) x.Name = "test")
然后
Await (CType(user, SocketGuildUser)).AddRoleAsync(role)