自动分配角色已加入用户Discord.net

时间:2019-05-03 04:56:16

标签: vb.net discord.net

我正在尝试在Discord服务器中添加自动角色的新成员, 例如,我正在使用Discord 1.0.1

role Name : (Test) / Role ID : (5246771013.....)

因此,我正在尝试两种方法,分别是nameid的角色。它们都不起作用。

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

但是它也不起作用。有什么建议吗?

1 个答案:

答案 0 :(得分:2)

通过ID:

downloadFile = (file) => {
let appFolder;
if (Platform.OS === 'ios') {
  appFolder = RNFetchBlob.fs.dirs.DocumentDir;
} else {
  appFolder = RNFetchBlob.fs.dirs.DownloadDir;
}

const downloadedFile = `${appFolder}/${file.fileName}.pdf`;

return RNFetchBlob.fs.writeFile(downloadedFile, file.base64, 'base64')
  .then(() => {
    console.log('PDF downloaded');
  })
  .catch((err) => {
    console.log(err);
  });

按名称:

 Dim role = (CType(channell, ITextChannel)).Guild.GetRole(5246771013.....)

然后

 Dim role = (CType(channell, ITextChannel)).Guild.Roles.FirstOrDefault(Function(x) x.Name = "test")