using System; using System.Collections.Generic; using System.IO; using System.Threading.Tasks; namespace Discord { /// /// Represents a generic Discord client. /// public interface IDiscordClient : IDisposable { /// /// Gets the current state of connection. /// ConnectionState ConnectionState { get; } /// /// Gets the currently logged-in user. /// ISelfUser CurrentUser { get; } /// /// Gets the token type of the logged-in user. /// TokenType TokenType { get; } /// /// Starts the connection between Discord and the client.. /// /// /// This method will initialize the connection between the client and Discord. /// /// This method will immediately return after it is called, as it will initialize the connection on /// another thread. /// /// /// /// A task that represents the asynchronous start operation. /// Task StartAsync(); /// /// Stops the connection between Discord and the client. /// /// /// A task that represents the asynchronous stop operation. /// Task StopAsync(); /// /// Gets a Discord application information for the logged-in user. /// /// /// This method reflects your application information you submitted when creating a Discord application via /// the Developer Portal. /// /// The options to be used when sending the request. /// /// A task that represents the asynchronous get operation. The task result contains the application /// information. /// Task GetApplicationInfoAsync(RequestOptions options = null); /// /// Gets a generic channel. /// /// /// /// var channel = await _client.GetChannelAsync(381889909113225237); /// if (channel != null && channel is IMessageChannel msgChannel) /// { /// await msgChannel.SendMessageAsync($"{msgChannel} is created at {msgChannel.CreatedAt}"); /// } /// /// /// The snowflake identifier of the channel (e.g. `381889909113225237`). /// The that determines whether the object should be fetched from cache. /// The options to be used when sending the request. /// /// A task that represents the asynchronous get operation. The task result contains the channel associated /// with the snowflake identifier; null when the channel cannot be found. /// Task GetChannelAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); /// /// Gets a collection of private channels opened in this session. /// /// The that determines whether the object should be fetched from cache. /// The options to be used when sending the request. /// /// This method will retrieve all private channels (including direct-message, group channel and such) that /// are currently opened in this session. /// /// This method will not return previously opened private channels outside of the current session! If /// you have just started the client, this may return an empty collection. /// /// /// /// A task that represents the asynchronous get operation. The task result contains a read-only collection /// of private channels that the user currently partakes in. /// Task> GetPrivateChannelsAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); /// /// Gets a collection of direct message channels opened in this session. /// /// /// This method returns a collection of currently opened direct message channels. /// /// This method will not return previously opened DM channels outside of the current session! If you /// have just started the client, this may return an empty collection. /// /// /// The that determines whether the object should be fetched from cache. /// The options to be used when sending the request. /// /// A task that represents the asynchronous get operation. The task result contains a read-only collection /// of direct-message channels that the user currently partakes in. /// Task> GetDMChannelsAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); /// /// Gets a collection of group channels opened in this session. /// /// /// This method returns a collection of currently opened group channels. /// /// This method will not return previously opened group channels outside of the current session! If you /// have just started the client, this may return an empty collection. /// /// /// The that determines whether the object should be fetched from cache. /// The options to be used when sending the request. /// /// A task that represents the asynchronous get operation. The task result contains a read-only collection /// of group channels that the user currently partakes in. /// Task> GetGroupChannelsAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); /// /// Gets the connections that the user has set up. /// /// The options to be used when sending the request. /// /// A task that represents the asynchronous get operation. The task result contains a read-only collection of connections. /// Task> GetConnectionsAsync(RequestOptions options = null); /// /// Gets a guild. /// /// The guild snowflake identifier. /// The that determines whether the object should be fetched from cache. /// The options to be used when sending the request. /// /// A task that represents the asynchronous get operation. The task result contains the guild associated /// with the snowflake identifier; null when the guild cannot be found. /// Task GetGuildAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); /// /// Gets a collection of guilds that the user is currently in. /// /// The that determines whether the object should be fetched from cache. /// The options to be used when sending the request. /// /// A task that represents the asynchronous get operation. The task result contains a read-only collection /// of guilds that the current user is in. /// Task> GetGuildsAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); /// /// Creates a guild for the logged-in user who is in less than 10 active guilds. /// /// /// This method creates a new guild on behalf of the logged-in user. /// /// Due to Discord's limitation, this method will only work for users that are in less than 10 guilds. /// /// /// The name of the new guild. /// The voice region to create the guild with. /// The icon of the guild. /// The options to be used when sending the request. /// /// A task that represents the asynchronous creation operation. The task result contains the created guild. /// Task CreateGuildAsync(string name, IVoiceRegion region, Stream jpegIcon = null, RequestOptions options = null); /// /// Gets an invite. /// /// The invitation identifier. /// The options to be used when sending the request. /// /// A task that represents the asynchronous get operation. The task result contains the invite information. /// Task GetInviteAsync(string inviteId, RequestOptions options = null); /// /// Gets a user. /// /// /// /// var user = await _client.GetUserAsync(168693960628371456); /// if (user != null) /// Console.WriteLine($"{user} is created at {user.CreatedAt}."; /// /// /// The snowflake identifier of the user (e.g. `168693960628371456`). /// The that determines whether the object should be fetched from cache. /// The options to be used when sending the request. /// /// A task that represents the asynchronous get operation. The task result contains the user associated with /// the snowflake identifier; null if the user is not found. /// Task GetUserAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); /// /// Gets a user. /// /// /// /// var user = await _client.GetUserAsync("Still", "2876"); /// if (user != null) /// Console.WriteLine($"{user} is created at {user.CreatedAt}."; /// /// /// The name of the user (e.g. `Still`). /// The discriminator value of the user (e.g. `2876`). /// The options to be used when sending the request. /// /// A task that represents the asynchronous get operation. The task result contains the user associated with /// the name and the discriminator; null if the user is not found. /// Task GetUserAsync(string username, string discriminator, RequestOptions options = null); /// /// Gets a collection of the available voice regions. /// /// /// The following example gets the most optimal voice region from the collection. /// /// var regions = await client.GetVoiceRegionsAsync(); /// var optimalRegion = regions.FirstOrDefault(x => x.IsOptimal); /// /// /// The options to be used when sending the request. /// /// A task that represents the asynchronous get operation. The task result contains a read-only collection /// with all of the available voice regions in this session. /// Task> GetVoiceRegionsAsync(RequestOptions options = null); /// /// Gets a voice region. /// /// The identifier of the voice region (e.g. eu-central ). /// The options to be used when sending the request. /// /// A task that represents the asynchronous get operation. The task result contains the voice region /// associated with the identifier; null if the voice region is not found. /// Task GetVoiceRegionAsync(string id, RequestOptions options = null); /// /// Gets a webhook available. /// /// The identifier of the webhook. /// The options to be used when sending the request. /// /// A task that represents the asynchronous get operation. The task result contains a webhook associated /// with the identifier; null if the webhook is not found. /// Task GetWebhookAsync(ulong id, RequestOptions options = null); /// /// Gets the recommended shard count as suggested by Discord. /// /// The options to be used when sending the request. /// /// A task that represents the asynchronous get operation. The task result contains an /// that represents the number of shards that should be used with this account. /// Task GetRecommendedShardCountAsync(RequestOptions options = null); } }