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
This commit is contained in:
committed by
Christopher F
parent
10f67a8098
commit
d30d12246d
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -66,5 +66,9 @@ namespace Discord
|
||||
/// Gets or sets the ID of the owner of this guild.
|
||||
/// </summary>
|
||||
public Optional<ulong> OwnerId { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the explicit content filter level of this guild.
|
||||
/// </summary>
|
||||
public Optional<ExplicitContentFilterLevel> ExplicitContentFilter { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,6 +53,13 @@ namespace Discord
|
||||
/// </returns>
|
||||
VerificationLevel VerificationLevel { get; }
|
||||
/// <summary>
|
||||
/// Gets the level of content filtering applied to user's content in a Guild.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The level of explicit content filtering.
|
||||
/// </returns>
|
||||
ExplicitContentFilterLevel ExplicitContentFilter { get; }
|
||||
/// <summary>
|
||||
/// Gets the ID of this guild's icon.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
@@ -141,6 +148,13 @@ namespace Discord
|
||||
/// </returns>
|
||||
ulong OwnerId { get; }
|
||||
/// <summary>
|
||||
/// Gets the application ID of the guild creator if it is bot-created.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// A <see cref="ulong"/> representing the snowflake identifier of the application ID that created this guild, or <c>null</c> if it was not bot-created.
|
||||
/// </returns>
|
||||
ulong? ApplicationId { get; }
|
||||
/// <summary>
|
||||
/// Gets the ID of the region hosting this guild's voice channels.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
|
||||
@@ -100,5 +100,25 @@ namespace Discord
|
||||
/// A read-only collection of user IDs.
|
||||
/// </returns>
|
||||
IReadOnlyCollection<ulong> MentionedUserIds { get; }
|
||||
/// <summary>
|
||||
/// Returns the Activity associated with a message.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Sent with Rich Presence-related chat embeds.
|
||||
/// </remarks>
|
||||
/// <returns>
|
||||
/// A message's activity, if any is associated.
|
||||
/// </returns>
|
||||
MessageActivity Activity { get; }
|
||||
/// <summary>
|
||||
/// Returns the Application associated with a messsage.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Sent with Rich-Presence-related chat embeds.
|
||||
/// </remarks>
|
||||
/// <returns>
|
||||
/// A message's application, if any is associated.
|
||||
/// </returns>
|
||||
MessageApplication Application { get; }
|
||||
}
|
||||
}
|
||||
|
||||
27
src/Discord.Net.Core/Entities/Messages/MessageActivity.cs
Normal file
27
src/Discord.Net.Core/Entities/Messages/MessageActivity.cs
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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
src/Discord.Net.Core/Entities/Messages/MessageApplication.cs
Normal file
43
src/Discord.Net.Core/Entities/Messages/MessageApplication.cs
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user