Added remaining gateway events, added IAudioChannel, added CacheModes
This commit is contained in:
8
src/Discord.Net.Core/Entities/CacheMode.cs
Normal file
8
src/Discord.Net.Core/Entities/CacheMode.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace Discord
|
||||
{
|
||||
public enum CacheMode
|
||||
{
|
||||
AllowDownload,
|
||||
CacheOnly
|
||||
}
|
||||
}
|
||||
6
src/Discord.Net.Core/Entities/Channels/IAudioChannel.cs
Normal file
6
src/Discord.Net.Core/Entities/Channels/IAudioChannel.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace Discord
|
||||
{
|
||||
public interface IAudioChannel
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -5,13 +5,10 @@ namespace Discord
|
||||
{
|
||||
public interface IChannel : ISnowflakeEntity
|
||||
{
|
||||
IReadOnlyCollection<IUser> CachedUsers { get; }
|
||||
|
||||
/// <summary> Gets a collection of all users in this channel. </summary>
|
||||
IAsyncEnumerable<IReadOnlyCollection<IUser>> GetUsersAsync();
|
||||
IAsyncEnumerable<IReadOnlyCollection<IUser>> GetUsersAsync(CacheMode mode = CacheMode.AllowDownload);
|
||||
|
||||
/// <summary> Gets a user in this channel with the provided id.</summary>
|
||||
Task<IUser> GetUserAsync(ulong id);
|
||||
IUser GetCachedUser(ulong id);
|
||||
Task<IUser> GetUserAsync(ulong id, CacheMode mode = CacheMode.AllowDownload);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Discord
|
||||
{
|
||||
public interface IGroupChannel : IMessageChannel, IPrivateChannel
|
||||
public interface IGroupChannel : IMessageChannel, IPrivateChannel, IAudioChannel
|
||||
{
|
||||
///// <summary> Adds a user to this group. </summary>
|
||||
//Task AddUserAsync(IUser user);
|
||||
|
||||
//new IReadOnlyCollection<IGroupUser> CachedUsers { get; }
|
||||
|
||||
/// <summary> Leaves this group. </summary>
|
||||
Task LeaveAsync();
|
||||
}
|
||||
|
||||
@@ -14,7 +14,8 @@ namespace Discord
|
||||
|
||||
/// <summary> Gets the id of the guild this channel is a member of. </summary>
|
||||
ulong GuildId { get; }
|
||||
new IReadOnlyCollection<IGuildUser> CachedUsers { get; }
|
||||
/// <summary> Gets a collection of permission overwrites for this channel. </summary>
|
||||
IReadOnlyCollection<Overwrite> PermissionOverwrites { get; }
|
||||
|
||||
/// <summary> Creates a new invite to this channel. </summary>
|
||||
/// <param name="maxAge"> The time (in seconds) until the invite expires. Set to null to never expire. </param>
|
||||
@@ -23,9 +24,6 @@ namespace Discord
|
||||
Task<IInviteMetadata> CreateInviteAsync(int? maxAge = 1800, int? maxUses = default(int?), bool isTemporary = false);
|
||||
/// <summary> Returns a collection of all invites to this channel. </summary>
|
||||
Task<IReadOnlyCollection<IInviteMetadata>> GetInvitesAsync();
|
||||
|
||||
/// <summary> Gets a collection of permission overwrites for this channel. </summary>
|
||||
IReadOnlyCollection<Overwrite> PermissionOverwrites { get; }
|
||||
|
||||
/// <summary> Modifies this guild channel. </summary>
|
||||
Task ModifyAsync(Action<ModifyGuildChannelParams> func);
|
||||
@@ -44,9 +42,8 @@ namespace Discord
|
||||
Task AddPermissionOverwriteAsync(IUser user, OverwritePermissions permissions);
|
||||
|
||||
/// <summary> Gets a collection of all users in this channel. </summary>
|
||||
new IAsyncEnumerable<IReadOnlyCollection<IGuildUser>> GetUsersAsync();
|
||||
new IAsyncEnumerable<IReadOnlyCollection<IGuildUser>> GetUsersAsync(CacheMode mode = CacheMode.AllowDownload);
|
||||
/// <summary> Gets a user in this channel with the provided id.</summary>
|
||||
new Task<IGuildUser> GetUserAsync(ulong id);
|
||||
new IGuildUser GetCachedUser(ulong id);
|
||||
new Task<IGuildUser> GetUserAsync(ulong id, CacheMode mode = CacheMode.AllowDownload);
|
||||
}
|
||||
}
|
||||
@@ -7,9 +7,6 @@ namespace Discord
|
||||
{
|
||||
public interface IMessageChannel : IChannel
|
||||
{
|
||||
/// <summary> Gets all messages in this channel's cache. </summary>
|
||||
IReadOnlyCollection<IMessage> CachedMessages { get; }
|
||||
|
||||
/// <summary> Sends a message to this message channel. </summary>
|
||||
Task<IUserMessage> SendMessageAsync(string text, bool isTTS = false);
|
||||
/// <summary> Sends a file to this text channel, with an optional caption. </summary>
|
||||
@@ -18,13 +15,11 @@ namespace Discord
|
||||
Task<IUserMessage> SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false);
|
||||
|
||||
/// <summary> Gets a message from this message channel with the given id, or null if not found. </summary>
|
||||
Task<IMessage> GetMessageAsync(ulong id);
|
||||
/// <summary> Gets the message from this channel's cache with the given id, or null if not found. </summary>
|
||||
IMessage GetCachedMessage(ulong id);
|
||||
Task<IMessage> GetMessageAsync(ulong id, CacheMode mode = CacheMode.AllowDownload);
|
||||
/// <summary> Gets the last N messages from this message channel. </summary>
|
||||
IAsyncEnumerable<IReadOnlyCollection<IMessage>> GetMessagesAsync(int limit = DiscordConfig.MaxMessagesPerBatch);
|
||||
IAsyncEnumerable<IReadOnlyCollection<IMessage>> GetMessagesAsync(int limit = DiscordConfig.MaxMessagesPerBatch, CacheMode mode = CacheMode.AllowDownload);
|
||||
/// <summary> Gets a collection of messages in this channel. </summary>
|
||||
IAsyncEnumerable<IReadOnlyCollection<IMessage>> GetMessagesAsync(ulong fromMessageId, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch);
|
||||
IAsyncEnumerable<IReadOnlyCollection<IMessage>> GetMessagesAsync(ulong fromMessageId, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch, CacheMode mode = CacheMode.AllowDownload);
|
||||
/// <summary> Gets a collection of pinned messages in this channel. </summary>
|
||||
Task<IReadOnlyCollection<IMessage>> GetPinnedMessagesAsync();
|
||||
/// <summary> Bulk deletes multiple messages. </summary>
|
||||
|
||||
@@ -5,7 +5,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Discord
|
||||
{
|
||||
public interface IVoiceChannel : IGuildChannel
|
||||
public interface IVoiceChannel : IGuildChannel, IAudioChannel
|
||||
{
|
||||
/// <summary> Gets the bitrate, in bits per second, clients in this voice channel are requested to use. </summary>
|
||||
int Bitrate { get; }
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
//using Discord.Rest;
|
||||
using System.Diagnostics;
|
||||
using Model = Discord.API.Ban;
|
||||
|
||||
namespace Discord
|
||||
namespace Discord
|
||||
{
|
||||
|
||||
public interface IBan
|
||||
{
|
||||
IUser User { get; }
|
||||
|
||||
@@ -41,7 +41,6 @@ namespace Discord
|
||||
ulong OwnerId { get; }
|
||||
/// <summary> Gets the id of the region hosting this guild's voice channels. </summary>
|
||||
string VoiceRegionId { get; }
|
||||
|
||||
/// <summary> Gets the IAudioClient currently associated with this guild. </summary>
|
||||
IAudioClient AudioClient { get; }
|
||||
/// <summary> Gets the built-in role containing all users in this guild. </summary>
|
||||
@@ -52,7 +51,6 @@ namespace Discord
|
||||
IReadOnlyCollection<string> Features { get; }
|
||||
/// <summary> Gets a collection of all roles in this guild. </summary>
|
||||
IReadOnlyCollection<IRole> Roles { get; }
|
||||
IReadOnlyCollection<IGuildUser> CachedUsers { get; }
|
||||
|
||||
/// <summary> Modifies this guild. </summary>
|
||||
Task ModifyAsync(Action<ModifyGuildParams> func);
|
||||
@@ -77,10 +75,9 @@ namespace Discord
|
||||
Task RemoveBanAsync(ulong userId);
|
||||
|
||||
/// <summary> Gets a collection of all channels in this guild. </summary>
|
||||
Task<IReadOnlyCollection<IGuildChannel>> GetChannelsAsync();
|
||||
Task<IReadOnlyCollection<IGuildChannel>> GetChannelsAsync(CacheMode mode = CacheMode.AllowDownload);
|
||||
/// <summary> Gets the channel in this guild with the provided id, or null if not found. </summary>
|
||||
Task<IGuildChannel> GetChannelAsync(ulong id);
|
||||
IGuildChannel GetCachedChannel(ulong id);
|
||||
Task<IGuildChannel> GetChannelAsync(ulong id, CacheMode mode = CacheMode.AllowDownload);
|
||||
/// <summary> Creates a new text channel. </summary>
|
||||
Task<ITextChannel> CreateTextChannelAsync(string name);
|
||||
/// <summary> Creates a new voice channel. </summary>
|
||||
@@ -98,12 +95,11 @@ namespace Discord
|
||||
Task<IRole> CreateRoleAsync(string name, GuildPermissions? permissions = null, Color? color = null, bool isHoisted = false);
|
||||
|
||||
/// <summary> Gets a collection of all users in this guild. </summary>
|
||||
Task<IReadOnlyCollection<IGuildUser>> GetUsersAsync();
|
||||
Task<IReadOnlyCollection<IGuildUser>> GetUsersAsync(CacheMode mode = CacheMode.AllowDownload); //TODO: shouldnt this be paged?
|
||||
/// <summary> Gets the user in this guild with the provided id, or null if not found. </summary>
|
||||
Task<IGuildUser> GetUserAsync(ulong id);
|
||||
IGuildUser GetCachedUser(ulong id);
|
||||
Task<IGuildUser> GetUserAsync(ulong id, CacheMode mode = CacheMode.AllowDownload);
|
||||
/// <summary> Gets the current user for this guild. </summary>
|
||||
Task<IGuildUser> GetCurrentUserAsync();
|
||||
Task<IGuildUser> GetCurrentUserAsync(CacheMode mode = CacheMode.AllowDownload);
|
||||
/// <summary> Downloads all users for this guild if the current list is incomplete. </summary>
|
||||
Task DownloadUsersAsync();
|
||||
/// <summary> Removes all users from this guild if they have not logged on in a provided number of days or, if simulate is true, returns the number of users that would be removed. </summary>
|
||||
|
||||
@@ -17,8 +17,8 @@ namespace Discord
|
||||
/// <summary> Gets the username for this user. </summary>
|
||||
string Username { get; }
|
||||
|
||||
/// <summary> Returns a private message channel to this user, returning null if one does not exist or is not cached. </summary>
|
||||
IDMChannel GetCachedDMChannel();
|
||||
/// <summary> Returns a private message channel to this user, creating one if it does not already exist. </summary>
|
||||
Task<IDMChannel> GetDMChannelAsync(CacheMode mode = CacheMode.AllowDownload);
|
||||
/// <summary> Returns a private message channel to this user, creating one if it does not already exist. </summary>
|
||||
Task<IDMChannel> CreateDMChannelAsync();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user