-
-
Notifications
You must be signed in to change notification settings - Fork 737
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Guild and Message Models (#1165)
* Add ExplicitContentFilter property to Guild * re-order properties to match order listed on api docs * re-order SystemChannelId to match api docs * Implement ApplicationId in Guild model * Add ExplicitContentFilter property to Guild * re-order properties to match order listed on api docs * re-order SystemChannelId to match api docs * Implement ApplicationId in Guild model * Improve xmldoc for IGuild ExplicitContentFilter * Update xmldoc * docs "Id" -> "ID" * rename Test.GuildPermissions to a more general Test.Guilds * Add ExplicitContentFilter to GuildProperties * Add a test for ExplicitContentFilterLevel modification behavior * Implement ModifyAsync behavior * simplify ExplicitContentFilter test * Add RestGuild ApplicationId inheritdoc * Implement message Activity and Application model update * RestMessage Application and Activity implementation * add ToString to MessageApplication * Add IconUrl property to MessageApplication * clean up whitespace * another excessive whitespace removal
- Loading branch information
1 parent
10f67a8
commit d30d122
Showing
18 changed files
with
302 additions
and
8 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
src/Discord.Net.Core/Entities/Guilds/ExplicitContentFilterLevel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
namespace Discord | ||
{ | ||
public enum ExplicitContentFilterLevel | ||
{ | ||
/// <summary> No messages will be scanned. </summary> | ||
Disabled = 0, | ||
/// <summary> Scans messages from all guild members that do not have a role. </summary> | ||
/// <remarks> Recommented option for servers that use roles for trusted membership. </remarks> | ||
MembersWithoutRoles = 1, | ||
/// <summary> Scan messages sent by all guild members. </summary> | ||
AllMembers = 2 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Discord | ||
{ | ||
[DebuggerDisplay(@"{DebuggerDisplay,nq}")] | ||
public class MessageActivity | ||
{ | ||
/// <summary> | ||
/// Gets the type of activity of this message. | ||
/// </summary> | ||
public MessageActivityType Type { get; set; } | ||
/// <summary> | ||
/// Gets the party ID of this activity, if any. | ||
/// </summary> | ||
public string PartyId { get; set; } | ||
|
||
private string DebuggerDisplay | ||
=> $"{Type}{(string.IsNullOrWhiteSpace(PartyId) ? "" : $" {PartyId}")}"; | ||
|
||
public override string ToString() => DebuggerDisplay; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/Discord.Net.Core/Entities/Messages/MessageActivityType.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Discord | ||
{ | ||
public enum MessageActivityType | ||
{ | ||
Join = 1, | ||
Spectate = 2, | ||
Listen = 3, | ||
JoinRequest = 5 | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
src/Discord.Net.Core/Entities/Messages/MessageApplication.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Discord | ||
{ | ||
[DebuggerDisplay(@"{DebuggerDisplay,nq}")] | ||
public class MessageApplication | ||
{ | ||
/// <summary> | ||
/// Gets the snowflake ID of the application. | ||
/// </summary> | ||
public ulong Id { get; set; } | ||
/// <summary> | ||
/// Gets the ID of the embed's image asset. | ||
/// </summary> | ||
public string CoverImage { get; set; } | ||
/// <summary> | ||
/// Gets the application's description. | ||
/// </summary> | ||
public string Description { get; set; } | ||
/// <summary> | ||
/// Gets the ID of the application's icon. | ||
/// </summary> | ||
public string Icon { get; set; } | ||
/// <summary> | ||
/// Gets the Url of the application's icon. | ||
/// </summary> | ||
public string IconUrl | ||
=> $"https://cdn.discordapp.com/app-icons/{Id}/{Icon}"; | ||
/// <summary> | ||
/// Gets the name of the application. | ||
/// </summary> | ||
public string Name { get; set; } | ||
private string DebuggerDisplay | ||
=> $"{Name} ({Id}): {Description}"; | ||
public override string ToString() | ||
=> DebuggerDisplay; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using Newtonsoft.Json; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Discord.API | ||
{ | ||
public class MessageActivity | ||
{ | ||
[JsonProperty("type")] | ||
public Optional<MessageActivityType> Type { get; set; } | ||
[JsonProperty("party_id")] | ||
public Optional<string> PartyId { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using Newtonsoft.Json; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Discord.API | ||
{ | ||
public class MessageApplication | ||
{ | ||
/// <summary> | ||
/// Gets the snowflake ID of the application. | ||
/// </summary> | ||
[JsonProperty("id")] | ||
public ulong Id { get; set; } | ||
/// <summary> | ||
/// Gets the ID of the embed's image asset. | ||
/// </summary> | ||
[JsonProperty("cover_image")] | ||
public string CoverImage { get; set; } | ||
/// <summary> | ||
/// Gets the application's description. | ||
/// </summary> | ||
[JsonProperty("description")] | ||
public string Description { get; set; } | ||
/// <summary> | ||
/// Gets the ID of the application's icon. | ||
/// </summary> | ||
[JsonProperty("icon")] | ||
public string Icon { get; set; } | ||
/// <summary> | ||
/// Gets the name of the application. | ||
/// </summary> | ||
[JsonProperty("name")] | ||
public string Name { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.