DSharpPlus/Clients/DiscordClient.cs
/// <summary>
/// Gets a guild.
/// <para>Setting <paramref name="withCounts"/> to true will make a REST request.</para>
/// </summary>
/// <param name="id">The guild ID to search for.</param>
/// <param name="withCounts">Whether to include approximate presence and member counts in the returned guild.</param>
/// <returns>The requested Guild.</returns>
/// <exception cref="Exceptions.NotFoundException">Thrown when the guild does not exist.</exception>
/// <exception cref="Exceptions.BadRequestException">Thrown when an invalid parameter was provided.</exception>
/// <exception cref="Exceptions.ServerErrorException">Thrown when Discord is unable to process the request.</exception>
Gets a guild.
Setting  to true will make a REST request.
Gets a guild . Setting to true will make a REST request .
public async Task<DiscordGuild> GetGuildAsync(ulong id, bool? withCounts = null)
        {
            if (this._guilds.TryGetValue(id, out var guild) && (!withCounts.HasValue || !withCounts.Value))
                return guild;
            guild = await this.ApiClient.GetGuildAsync(id, withCounts).ConfigureAwait(false);
            var channels = await this.ApiClient.GetGuildChannelsAsync(guild.Id).ConfigureAwait(false);
            foreach (var channel in channels) guild._channels[channel.Id] = channel;
            return guild;
        }
public async Task < DiscordGuild > GetGuildAsync ( ulong id , bool ? withCounts = null ) { if ( this . _guilds . TryGetValue ( id , out var guild ) && ( ! withCounts . HasValue || ! withCounts . Value ) ) return guild ; guild = await this . ApiClient . GetGuildAsync ( id , withCounts ) . ConfigureAwait ( false ) ; var channels = await this . ApiClient . GetGuildChannelsAsync ( guild . Id ) . ConfigureAwait ( false ) ; foreach ( var channel in channels ) guild . _channels [ channel . Id ] = channel ; return guild ; }
Gets a guild.
Gets a guild .
The requested Guild.
The requested Guild .
Thrown when the guild does not exist.
Thrown when the guild does not exist .
Thrown when an invalid parameter was provided.
Thrown when an invalid parameter was provided .
Thrown when Discord is unable to process the request.
Thrown when Discord is unable to process the request .
id
ulong
The guild ID to search for.
The guild ID to search for .
withCounts
bool?
Whether to include approximate presence and member counts in the returned guild.
Whether to include approximate presence and member counts in the returned guild .