| @@ -93,7 +93,19 @@ namespace Discord | |||
| /// The maximum number of guilds that can be gotten per-batch. | |||
| /// </returns> | |||
| public const int MaxGuildsPerBatch = 100; | |||
| /// <summary> | |||
| /// Returns the max user reactions allowed to be in a request. | |||
| /// </summary> | |||
| /// <returns> | |||
| /// The maximum number of user reactions that can be gotten per-batch. | |||
| /// </returns> | |||
| public const int MaxUserReactionsPerBatch = 100; | |||
| /// <summary> | |||
| /// Returns the max audit log entries allowed to be in a request. | |||
| /// </summary> | |||
| /// <returns> | |||
| /// The maximum number of audit log entries that can be gotten per-batch. | |||
| /// </returns> | |||
| public const int MaxAuditLogEntriesPerBatch = 100; | |||
| /// <summary> | |||
| @@ -1,13 +1,7 @@ | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| using System.Threading.Tasks; | |||
| namespace Discord | |||
| { | |||
| /// <summary> | |||
| /// Represents data applied to an <see cref="IAuditLogEntry"/> | |||
| /// Represents data applied to an <see cref="IAuditLogEntry"/>. | |||
| /// </summary> | |||
| public interface IAuditLogData | |||
| { } | |||
| @@ -22,7 +22,8 @@ namespace Discord | |||
| /// automatically moved to the AFK voice channel. | |||
| /// </summary> | |||
| /// <returns> | |||
| /// The amount of time in seconds for a user to be marked as inactive and moved into the AFK voice channel. | |||
| /// An <see cref="Int32"/> representing the amount of time in seconds for a user to be marked as inactive | |||
| /// and moved into the AFK voice channel. | |||
| /// </returns> | |||
| int AFKTimeout { get; } | |||
| /// <summary> | |||
| @@ -94,8 +95,12 @@ namespace Discord | |||
| bool Available { get; } | |||
| /// <summary> | |||
| /// Gets the ID of the AFK voice channel for this guild, or <c>null</c> if none is set. | |||
| /// Gets the ID of the AFK voice channel for this guild. | |||
| /// </summary> | |||
| /// <returns> | |||
| /// An <see cref="UInt64" /> representing the snowflake identifier of the AFK voice channel; <c>null</c> if | |||
| /// none is set. | |||
| /// </returns> | |||
| ulong? AFKChannelId { get; } | |||
| /// <summary> | |||
| /// Gets the ID of the the default channel for this guild. | |||
| @@ -542,7 +547,17 @@ namespace Discord | |||
| /// </returns> | |||
| Task<int> PruneUsersAsync(int days = 30, bool simulate = false, RequestOptions options = null); | |||
| /// <summary> Gets the specified number of audit log entries for this guild. </summary> | |||
| /// <summary> | |||
| /// Gets the specified number of audit log entries for this guild. | |||
| /// </summary> | |||
| /// <param name="limit">The number of audit log entries to fetch.</param> | |||
| /// <param name="mode"> | |||
| /// The <see cref="CacheMode" /> that determines whether the object should be fetched from cache. | |||
| /// </param> | |||
| /// <param name="options">The options to be used when sending the request.</param> | |||
| /// <returns> | |||
| /// An awaitable <see cref="Task"/> containing a collection of requested audit log entries. | |||
| /// </returns> | |||
| Task<IReadOnlyCollection<IAuditLogEntry>> GetAuditLogAsync(int limit = DiscordConfig.MaxAuditLogEntriesPerBatch, | |||
| CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); | |||
| @@ -25,9 +25,12 @@ namespace Discord | |||
| public RetryMode? RetryMode { get; set; } | |||
| public bool HeaderOnly { get; internal set; } | |||
| /// <summary> | |||
| /// Gets or sets the reason for this action in the guild's audit log. Note that this property may not apply | |||
| /// to every action. | |||
| /// Gets or sets the reason for this action in the guild's audit log. | |||
| /// </summary> | |||
| /// <remarks> | |||
| /// Gets or sets the reason that will be written to the guild's audit log if applicable. This may not apply | |||
| /// to all actions. | |||
| /// </remarks> | |||
| public string AuditLogReason { get; set; } | |||
| internal bool IgnoreState { get; set; } | |||
| @@ -1,10 +1,13 @@ | |||
| using System.Linq; | |||
| using System.Linq; | |||
| using Model = Discord.API.AuditLog; | |||
| using EntryModel = Discord.API.AuditLogEntry; | |||
| namespace Discord.Rest | |||
| { | |||
| /// <summary> | |||
| /// Represents an audit log data for a ban action. | |||
| /// </summary> | |||
| public class BanAuditLogData : IAuditLogData | |||
| { | |||
| private BanAuditLogData(IUser user) | |||
| @@ -18,6 +21,9 @@ namespace Discord.Rest | |||
| return new BanAuditLogData(RestUser.Create(discord, userInfo)); | |||
| } | |||
| /// <summary> | |||
| /// Gets the user that was banned. | |||
| /// </summary> | |||
| public IUser Target { get; } | |||
| } | |||
| } | |||
| @@ -1,4 +1,3 @@ | |||
| using Newtonsoft.Json.Linq; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| @@ -7,6 +6,9 @@ using EntryModel = Discord.API.AuditLogEntry; | |||
| namespace Discord.Rest | |||
| { | |||
| /// <summary> | |||
| /// Represents an audit log data for a channel creation. | |||
| /// </summary> | |||
| public class ChannelCreateAuditLogData : IAuditLogData | |||
| { | |||
| private ChannelCreateAuditLogData(ulong id, string name, ChannelType type, IReadOnlyCollection<Overwrite> overwrites) | |||
| @@ -44,9 +46,33 @@ namespace Discord.Rest | |||
| return new ChannelCreateAuditLogData(entry.TargetId.Value, name, type, overwrites.ToReadOnlyCollection()); | |||
| } | |||
| /// <summary> | |||
| /// Gets the snowflake ID of the created channel. | |||
| /// </summary> | |||
| /// <returns> | |||
| /// An <see cref="ulong"/> representing the snowflake identifier for the created channel. | |||
| /// </returns> | |||
| public ulong ChannelId { get; } | |||
| /// <summary> | |||
| /// Gets the name of the created channel. | |||
| /// </summary> | |||
| /// <returns> | |||
| /// A string containing the name of the created channel. | |||
| /// </returns> | |||
| public string ChannelName { get; } | |||
| /// <summary> | |||
| /// Gets the type of the created channel. | |||
| /// </summary> | |||
| /// <returns> | |||
| /// The type of channel that was created. | |||
| /// </returns> | |||
| public ChannelType ChannelType { get; } | |||
| /// <summary> | |||
| /// Gets a collection of permission overwrites that was assigned to the created channel. | |||
| /// </summary> | |||
| /// <returns> | |||
| /// A collection of permission <see cref="Overwrite" />. | |||
| /// </returns> | |||
| public IReadOnlyCollection<Overwrite> Overwrites { get; } | |||
| } | |||
| } | |||
| @@ -1,14 +1,14 @@ | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| using System.Threading.Tasks; | |||
| using Model = Discord.API.AuditLog; | |||
| using EntryModel = Discord.API.AuditLogEntry; | |||
| namespace Discord.Rest | |||
| { | |||
| /// <summary> | |||
| /// Represents an audit log data for a channel deletion. | |||
| /// </summary> | |||
| public class ChannelDeleteAuditLogData : IAuditLogData | |||
| { | |||
| private ChannelDeleteAuditLogData(ulong id, string name, ChannelType type, IReadOnlyCollection<Overwrite> overwrites) | |||
| @@ -37,9 +37,33 @@ namespace Discord.Rest | |||
| return new ChannelDeleteAuditLogData(id, name, type, overwrites.ToReadOnlyCollection()); | |||
| } | |||
| /// <summary> | |||
| /// Gets the snowflake ID of the deleted channel. | |||
| /// </summary> | |||
| /// <returns> | |||
| /// An <see cref="ulong"/> representing the snowflake identifier for the deleted channel. | |||
| /// </returns> | |||
| public ulong ChannelId { get; } | |||
| /// <summary> | |||
| /// Gets the name of the deleted channel. | |||
| /// </summary> | |||
| /// <returns> | |||
| /// A string containing the name of the deleted channel. | |||
| /// </returns> | |||
| public string ChannelName { get; } | |||
| /// <summary> | |||
| /// Gets the type of the deleted channel. | |||
| /// </summary> | |||
| /// <returns> | |||
| /// The type of channel that was deleted. | |||
| /// </returns> | |||
| public ChannelType ChannelType { get; } | |||
| /// <summary> | |||
| /// Gets a collection of permission overwrites that was assigned to the deleted channel. | |||
| /// </summary> | |||
| /// <returns> | |||
| /// A collection of permission <see cref="Overwrite" />. | |||
| /// </returns> | |||
| public IReadOnlyCollection<Overwrite> Overwrites { get; } | |||
| } | |||
| } | |||
| @@ -1,5 +1,8 @@ | |||
| namespace Discord.Rest | |||
| { | |||
| /// <summary> | |||
| /// Represents information for a channel. | |||
| /// </summary> | |||
| public struct ChannelInfo | |||
| { | |||
| internal ChannelInfo(string name, string topic, int? bitrate, int? limit) | |||
| @@ -10,9 +13,35 @@ namespace Discord.Rest | |||
| UserLimit = limit; | |||
| } | |||
| /// <summary> | |||
| /// Gets the name of this channel. | |||
| /// </summary> | |||
| /// <returns> | |||
| /// A string containing the name of this channel. | |||
| /// </returns> | |||
| public string Name { get; } | |||
| /// <summary> | |||
| /// Gets the topic of this channel. | |||
| /// </summary> | |||
| /// <returns> | |||
| /// A string containing the topic of this channel, if any. | |||
| /// </returns> | |||
| public string Topic { get; } | |||
| /// <summary> | |||
| /// Gets the bitrate of this channel if applicable. | |||
| /// </summary> | |||
| /// <returns> | |||
| /// An <see cref="System.Int32"/> representing the bitrate set for the voice channel; <c>null</c> if not | |||
| /// applicable. | |||
| /// </returns> | |||
| public int? Bitrate { get; } | |||
| /// <summary> | |||
| /// Gets the number of users allowed to be in this channel if applicable. | |||
| /// </summary> | |||
| /// <returns> | |||
| /// An <see cref="System.Int32" /> representing the number of users allowed to be in this voice channel; | |||
| /// <c>null</c> if not applicable. | |||
| /// </returns> | |||
| public int? UserLimit { get; } | |||
| } | |||
| } | |||
| @@ -1,10 +1,13 @@ | |||
| using System.Linq; | |||
| using System.Linq; | |||
| using Model = Discord.API.AuditLog; | |||
| using EntryModel = Discord.API.AuditLogEntry; | |||
| namespace Discord.Rest | |||
| { | |||
| /// <summary> | |||
| /// Represents an audit log data for a channel update. | |||
| /// </summary> | |||
| public class ChannelUpdateAuditLogData : IAuditLogData | |||
| { | |||
| private ChannelUpdateAuditLogData(ulong id, ChannelInfo before, ChannelInfo after) | |||
| @@ -38,6 +41,12 @@ namespace Discord.Rest | |||
| return new ChannelUpdateAuditLogData(entry.TargetId.Value, before, after); | |||
| } | |||
| /// <summary> | |||
| /// Gets the snowflake ID of the updated channel. | |||
| /// </summary> | |||
| /// <returns> | |||
| /// An <see cref="ulong"/> representing the snowflake identifier for the updated channel. | |||
| /// </returns> | |||
| public ulong ChannelId { get; } | |||
| public ChannelInfo Before { get; set; } | |||
| public ChannelInfo After { get; set; } | |||
| @@ -1,14 +1,13 @@ | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| using System.Threading.Tasks; | |||
| using Model = Discord.API.AuditLog; | |||
| using EntryModel = Discord.API.AuditLogEntry; | |||
| namespace Discord.Rest | |||
| { | |||
| /// <summary> | |||
| /// Represents an audit log data for an emoji creation. | |||
| /// </summary> | |||
| public class EmoteCreateAuditLogData : IAuditLogData | |||
| { | |||
| private EmoteCreateAuditLogData(ulong id, string name) | |||
| @@ -25,7 +24,19 @@ namespace Discord.Rest | |||
| return new EmoteCreateAuditLogData(entry.TargetId.Value, emoteName); | |||
| } | |||
| /// <summary> | |||
| /// Gets the snowflake ID of the created emoji. | |||
| /// </summary> | |||
| /// <returns> | |||
| /// An <see cref="System.UInt64"/> representing the snowflake identifier for the created emoji. | |||
| /// </returns> | |||
| public ulong EmoteId { get; } | |||
| /// <summary> | |||
| /// Gets the name of the created emoji. | |||
| /// </summary> | |||
| /// <returns> | |||
| /// A string containing the name of the created emoji. | |||
| /// </returns> | |||
| public string Name { get; } | |||
| } | |||
| } | |||
| @@ -1,10 +1,13 @@ | |||
| using System.Linq; | |||
| using System.Linq; | |||
| using Model = Discord.API.AuditLog; | |||
| using EntryModel = Discord.API.AuditLogEntry; | |||
| namespace Discord.Rest | |||
| { | |||
| /// <summary> | |||
| /// Represents an audit log data for an emoji deletion. | |||
| /// </summary> | |||
| public class EmoteDeleteAuditLogData : IAuditLogData | |||
| { | |||
| private EmoteDeleteAuditLogData(ulong id, string name) | |||
| @@ -22,7 +25,19 @@ namespace Discord.Rest | |||
| return new EmoteDeleteAuditLogData(entry.TargetId.Value, emoteName); | |||
| } | |||
| /// <summary> | |||
| /// Gets the snowflake ID of the deleted emoji. | |||
| /// </summary> | |||
| /// <returns> | |||
| /// An <see cref="System.UInt64"/> representing the snowflake identifier for the deleted emoji. | |||
| /// </returns> | |||
| public ulong EmoteId { get; } | |||
| /// <summary> | |||
| /// Gets the name of the deleted emoji. | |||
| /// </summary> | |||
| /// <returns> | |||
| /// A string containing the name of the deleted emoji. | |||
| /// </returns> | |||
| public string Name { get; } | |||
| } | |||
| } | |||
| @@ -1,10 +1,13 @@ | |||
| using System.Linq; | |||
| using System.Linq; | |||
| using Model = Discord.API.AuditLog; | |||
| using EntryModel = Discord.API.AuditLogEntry; | |||
| namespace Discord.Rest | |||
| { | |||
| /// <summary> | |||
| /// Represents an audit log data for an emoji update. | |||
| /// </summary> | |||
| public class EmoteUpdateAuditLogData : IAuditLogData | |||
| { | |||
| private EmoteUpdateAuditLogData(ulong id, string oldName, string newName) | |||
| @@ -24,8 +27,26 @@ namespace Discord.Rest | |||
| return new EmoteUpdateAuditLogData(entry.TargetId.Value, oldName, newName); | |||
| } | |||
| /// <summary> | |||
| /// Gets the snowflake ID of the updated emoji. | |||
| /// </summary> | |||
| /// <returns> | |||
| /// An <see cref="System.UInt64"/> representing the snowflake identifier of the updated emoji. | |||
| /// </returns> | |||
| public ulong EmoteId { get; } | |||
| /// <summary> | |||
| /// Gets the new name of the updated emoji. | |||
| /// </summary> | |||
| /// <returns> | |||
| /// A string containing the new name of the updated emoji. | |||
| /// </returns> | |||
| public string NewName { get; } | |||
| /// <summary> | |||
| /// Gets the old name of the updated emoji. | |||
| /// </summary> | |||
| /// <returns> | |||
| /// A string containing the old name of the updated emoji. | |||
| /// </returns> | |||
| public string OldName { get; } | |||
| } | |||
| } | |||
| @@ -1,5 +1,8 @@ | |||
| namespace Discord.Rest | |||
| { | |||
| /// <summary> | |||
| /// Represents information for a guild. | |||
| /// </summary> | |||
| public struct GuildInfo | |||
| { | |||
| internal GuildInfo(int? afkTimeout, DefaultMessageNotifications? defaultNotifs, | |||
| @@ -18,14 +21,66 @@ namespace Discord.Rest | |||
| ContentFilterLevel = filter; | |||
| } | |||
| /// <summary> | |||
| /// Gets the amount of time (in seconds) a user must be inactive in a voice channel for until they are | |||
| /// automatically moved to the AFK voice channel. | |||
| /// </summary> | |||
| /// <returns> | |||
| /// An <see cref="int"/> representing the amount of time in seconds for a user to be marked as inactive | |||
| /// and moved into the AFK voice channel. | |||
| /// </returns> | |||
| public int? AfkTimeout { get; } | |||
| /// <summary> | |||
| /// Gets the default message notifications for users who haven't explicitly set their notification settings. | |||
| /// </summary> | |||
| public DefaultMessageNotifications? DefaultMessageNotifications { get; } | |||
| /// <summary> | |||
| /// Gets the ID of the AFK voice channel for this guild. | |||
| /// </summary> | |||
| /// <returns> | |||
| /// An <see cref="ulong"/> representing the snowflake identifier of the AFK voice channel; <c>null</c> if | |||
| /// none is set. | |||
| /// </returns> | |||
| public ulong? AfkChannelId { get; } | |||
| /// <summary> | |||
| /// Gets the name of this guild. | |||
| /// </summary> | |||
| /// <returns> | |||
| /// A string containing the name of this guild. | |||
| /// </returns> | |||
| public string Name { get; } | |||
| /// <summary> | |||
| /// Gets the ID of the region hosting this guild's voice channels. | |||
| /// </summary> | |||
| public string RegionId { get; } | |||
| /// <summary> | |||
| /// Gets the ID of this guild's icon. | |||
| /// </summary> | |||
| /// <returns> | |||
| /// An identifier for the splash image; <c>null</c> if none is set. | |||
| /// </returns> | |||
| public string IconHash { get; } | |||
| /// <summary> | |||
| /// Gets the level of requirements a user must fulfill before being allowed to post messages in this guild. | |||
| /// </summary> | |||
| /// <returns> | |||
| /// The level of requirements. | |||
| /// </returns> | |||
| public VerificationLevel? VerificationLevel { get; } | |||
| /// <summary> | |||
| /// Gets the owner of this guild. | |||
| /// </summary> | |||
| /// <returns> | |||
| /// An <see cref="IUser"/> object representing the owner of this guild. | |||
| /// </returns> | |||
| public IUser Owner { get; } | |||
| /// <summary> | |||
| /// Gets the level of Multi-Factor Authentication requirements a user must fulfill before being allowed to | |||
| /// perform administrative actions in this guild. | |||
| /// </summary> | |||
| /// <returns> | |||
| /// The level of MFA requirement. | |||
| /// </returns> | |||
| public MfaLevel? MfaLevel { get; } | |||
| public int? ContentFilterLevel { get; } | |||
| } | |||