DSharpPlus/Entities/Guild/DiscordGuild.cs
/// <summary>
/// Gets a member of this guild by their user ID.
/// </summary>
/// <param name="userId">ID of the member to get.</param>
/// <returns>The requested member.</returns>
/// <exception cref="Exceptions.ServerErrorException">Thrown when Discord is unable to process the request.</exception>
Gets a member of this guild by their user ID.
Gets a member of this guild by their user ID .
public async Task<DiscordMember> GetMemberAsync(ulong userId)
        {
            if (this._members != null && this._members.TryGetValue(userId, out var mbr))
                return mbr;
            mbr = await this.Discord.ApiClient.GetGuildMemberAsync(Id, userId).ConfigureAwait(false);
            var intents = this.Discord.Configuration.Intents;
            if (intents.HasIntent(DiscordIntents.GuildMembers))
            {
                if (this._members != null)
                {
                    this._members[userId] = mbr;
                }
            }
            return mbr;
        }
public async Task < DiscordMember > GetMemberAsync ( ulong userId ) { if ( this . _members != null && this . _members . TryGetValue ( userId , out var mbr ) ) return mbr ; mbr = await this . Discord . ApiClient . GetGuildMemberAsync ( Id , userId ) . ConfigureAwait ( false ) ; var intents = this . Discord . Configuration . Intents ; if ( intents . HasIntent ( DiscordIntents . GuildMembers ) ) { if ( this . _members != null ) { this . _members [ userId ] = mbr ; } } return mbr ; }
Gets a member of this guild by their user ID.
Gets a member of this guild by their user ID .
The requested member.
The requested member .
Thrown when Discord is unable to process the request.
Thrown when Discord is unable to process the request .
userId
ulong
ID of the member to get.
ID of the member to get .