| @@ -5,11 +5,6 @@ namespace Discord | |||||
| /// </summary> | /// </summary> | ||||
| public interface IAttachment | public interface IAttachment | ||||
| { | { | ||||
| /// <summary> | |||||
| /// The prefix applied to files to indicate that it is a spoiler. | |||||
| /// </summary> | |||||
| public const string SpoilerPrefix = "SPOILER_"; | |||||
| /// <summary> | /// <summary> | ||||
| /// Gets the ID of this attachment. | /// Gets the ID of this attachment. | ||||
| /// </summary> | /// </summary> | ||||
| @@ -2,10 +2,14 @@ namespace Discord | |||||
| { | { | ||||
| public static class AttachmentExtensions | public static class AttachmentExtensions | ||||
| { | { | ||||
| /// <summary> | |||||
| /// The prefix applied to files to indicate that it is a spoiler. | |||||
| /// </summary> | |||||
| public const string SpoilerPrefix = "SPOILER_"; | |||||
| /// <summary> | /// <summary> | ||||
| /// Gets whether the message's attachments are spoilers or not. | /// Gets whether the message's attachments are spoilers or not. | ||||
| /// </summary> | /// </summary> | ||||
| public static bool IsSpoiler(this IAttachment attachment) | public static bool IsSpoiler(this IAttachment attachment) | ||||
| => attachment.Filename.StartsWith(IAttachment.SpoilerPrefix); | |||||
| => attachment.Filename.StartsWith(SpoilerPrefix); | |||||
| } | } | ||||
| } | } | ||||
| @@ -30,8 +30,8 @@ namespace Discord.API.Rest | |||||
| { | { | ||||
| var d = new Dictionary<string, object>(); | var d = new Dictionary<string, object>(); | ||||
| var filename = Filename.GetValueOrDefault("unknown.dat"); | var filename = Filename.GetValueOrDefault("unknown.dat"); | ||||
| if (IsSpoiler && !filename.StartsWith(IAttachment.SpoilerPrefix)) | |||||
| filename = filename.Insert(0, IAttachment.SpoilerPrefix); | |||||
| if (IsSpoiler && !filename.StartsWith(AttachmentExtensions.SpoilerPrefix)) | |||||
| filename = filename.Insert(0, AttachmentExtensions.SpoilerPrefix); | |||||
| d["file"] = new MultipartFile(File, filename); | d["file"] = new MultipartFile(File, filename); | ||||
| var payload = new Dictionary<string, object>(); | var payload = new Dictionary<string, object>(); | ||||