diff --git a/src/Discord.Net/Discord.Net.csproj b/src/Discord.Net/Discord.Net.csproj
index dc57c082a..a06f73582 100644
--- a/src/Discord.Net/Discord.Net.csproj
+++ b/src/Discord.Net/Discord.Net.csproj
@@ -2,6 +2,7 @@
netstandard2.0
+ 7.1
@@ -9,8 +10,4 @@
-
-
-
-
diff --git a/src/Discord.Net/Entities/Emotes/IEmote.cs b/src/Discord.Net/Entities/Emotes/IEmote.cs
new file mode 100644
index 000000000..4c90610a3
--- /dev/null
+++ b/src/Discord.Net/Entities/Emotes/IEmote.cs
@@ -0,0 +1,11 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Discord
+{
+ public interface IEmote
+ {
+ string Name { get; }
+ }
+}
diff --git a/src/Discord.Net/Entities/Emotes/IGuildEmote.cs b/src/Discord.Net/Entities/Emotes/IGuildEmote.cs
new file mode 100644
index 000000000..92d0de045
--- /dev/null
+++ b/src/Discord.Net/Entities/Emotes/IGuildEmote.cs
@@ -0,0 +1,7 @@
+namespace Discord
+{
+ public interface IGuildEmote : IEmote
+ {
+ // TODO
+ }
+}
diff --git a/src/Discord.Net/Entities/Guilds/IGuild.cs b/src/Discord.Net/Entities/Guilds/IGuild.cs
index 56f67c9ce..8375ccae3 100644
--- a/src/Discord.Net/Entities/Guilds/IGuild.cs
+++ b/src/Discord.Net/Entities/Guilds/IGuild.cs
@@ -142,5 +142,40 @@ namespace Discord
/// A string containing the identifier for the voice region that this guild uses (e.g. eu-central).
///
string VoiceRegionId { get; }
+ ///
+ /// Gets the currently associated with this guild.
+ ///
+ ///
+ /// An currently associated with this guild.
+ ///
+ //IAudioClient AudioClient { get; } // TODO: how do we want to handle audio?
+ ///
+ /// Gets the built-in role containing all users in this guild.
+ ///
+ ///
+ /// A role object that represents an @everyone role in this guild.
+ ///
+ IRole EveryoneRole { get; }
+ ///
+ /// Gets a collection of all custom emotes for this guild.
+ ///
+ ///
+ /// A read-only collection of all custom emotes for this guild.
+ ///
+ IReadOnlyCollection Emotes { get; }
+ ///
+ /// Gets a collection of all extra features added to this guild.
+ ///
+ ///
+ /// A read-only collection of enabled features in this guild.
+ ///
+ IReadOnlyCollection Features { get; }
+ ///
+ /// Gets a collection of all roles in this guild.
+ ///
+ ///
+ /// A read-only collection of roles found within this guild.
+ ///
+ IReadOnlyCollection Roles { get; }
}
}
diff --git a/src/Discord.Net/Entities/IMentionable.cs b/src/Discord.Net/Entities/IMentionable.cs
new file mode 100644
index 000000000..184c83ef3
--- /dev/null
+++ b/src/Discord.Net/Entities/IMentionable.cs
@@ -0,0 +1,7 @@
+namespace Discord
+{
+ public interface IMentionable
+ {
+ string Mention { get; }
+ }
+}
diff --git a/src/Discord.Net/Entities/Roles/IRole.cs b/src/Discord.Net/Entities/Roles/IRole.cs
new file mode 100644
index 000000000..f58fc79ee
--- /dev/null
+++ b/src/Discord.Net/Entities/Roles/IRole.cs
@@ -0,0 +1,85 @@
+using System;
+using System.Threading.Tasks;
+using Color = Wumpus.Entities.Color; // TODO: do we need to impl our own color struct?
+using GuildPermissions = Wumpus.Entities.GuildPermissions; // TODO: permissions
+
+namespace Discord
+{
+ ///
+ /// Represents a generic role object to be given to a guild user.
+ ///
+ public interface IRole : ISnowflakeEntity, IDeletable, IMentionable, IComparable
+ {
+ ///
+ /// Gets the guild that owns this role.
+ ///
+ ///
+ /// A guild representing the parent guild of this role.
+ ///
+ IGuild Guild { get; }
+
+ ///
+ /// Gets the color given to users of this role.
+ ///
+ ///
+ /// A struct representing the color of this role.
+ ///
+ Color Color { get; }
+ ///
+ /// Gets a value that indicates whether the role can be separated in the user list.
+ ///
+ ///
+ /// true if users of this role are separated in the user list; otherwise false.
+ ///
+ bool IsHoisted { get; }
+ ///
+ /// Gets a value that indicates whether the role is managed by Discord.
+ ///
+ ///
+ /// true if this role is automatically managed by Discord; otherwise false.
+ ///
+ bool IsManaged { get; }
+ ///
+ /// Gets a value that indicates whether the role is mentionable.
+ ///
+ ///
+ /// true if this role may be mentioned in messages; otherwise false.
+ ///
+ bool IsMentionable { get; }
+ ///
+ /// Gets the name of this role.
+ ///
+ ///
+ /// A string containing the name of this role.
+ ///
+ string Name { get; }
+ ///
+ /// Gets the permissions granted to members of this role.
+ ///
+ ///
+ /// A struct that this role possesses.
+ ///
+ GuildPermissions Permissions { get; }
+ ///
+ /// Gets this role's position relative to other roles in the same guild.
+ ///
+ ///
+ /// An representing the position of the role in the role list of the guild.
+ ///
+ int Position { get; }
+
+ ///
+ /// Modifies this role.
+ ///
+ ///
+ /// This method modifies this role with the specified properties. To see an example of this
+ /// method and what properties are available, please refer to .
+ ///
+ /// A delegate containing the properties to modify the role with.
+ /// The options to be used when sending the request.
+ ///
+ /// A task that represents the asynchronous modification operation.
+ ///
+ Task ModifyAsync(); // TODO: stub out request properties
+ }
+}
diff --git a/src/Discord.Net/IDiscordClient.cs b/src/Discord.Net/IDiscordClient.cs
index 4f6e022c4..797ed9292 100644
--- a/src/Discord.Net/IDiscordClient.cs
+++ b/src/Discord.Net/IDiscordClient.cs
@@ -6,12 +6,12 @@ namespace Discord
{
public interface IDiscordClient
{
+ event Action Ready;
+
WumpusGatewayClient Gateway { get; }
WumpusRestClient Rest { get; }
Task StartAsync();
Task StopAsync();
-
- event Action Ready;
}
}
diff --git a/src/Discord.Net/Models/Guilds/Guild.cs b/src/Discord.Net/Models/Guilds/Guild.cs
index 68c217b9f..2b1811d3a 100644
--- a/src/Discord.Net/Models/Guilds/Guild.cs
+++ b/src/Discord.Net/Models/Guilds/Guild.cs
@@ -9,7 +9,7 @@ namespace Discord
{
internal class Guild : SnowflakeEntity, IGuild
{
- public Guild(Model model, IDiscordClient client) : base(client)
+ public Guild(Model model, IDiscordClient discord) : base(discord)
{
Name = model.Name.ToString();
AFKTimeout = model.AfkTimeout;
@@ -35,6 +35,23 @@ namespace Discord
OwnerId = model.OwnerId;
ApplicationId = model.ApplicationId;
VoiceRegionId = null; // TODO?
+
+ Role[] roles = new Role[model.Roles.Length];
+ Role role;
+ for (int i = 0; i < model.Roles.Length; i++)
+ {
+ role = new Role(model.Roles[i], this, Discord);
+ if (role.Id == Id) // EveryoneRole has the same ID as the guild
+ EveryoneRole = role;
+ roles[i] = role;
+ }
+ Roles = roles;
+
+ // TODO: emotes
+ string[] features = new string[model.Features.Length];
+ for (int i = 0; i < model.Features.Length; i++)
+ features[i] = model.Features[i].ToString();
+ Features = features;
}
public string Name { get; set; }
@@ -61,6 +78,12 @@ namespace Discord
public ulong? ApplicationId { get; set; }
public string VoiceRegionId { get; set; }
- public Task DeleteAsync() => throw new NotImplementedException();
+ public IRole EveryoneRole { get; set; }
+ public IReadOnlyCollection Emotes { get; set; }
+ public IReadOnlyCollection Features { get; set; }
+ public IReadOnlyCollection Roles { get; set; }
+
+ public Task DeleteAsync()
+ => Discord.Rest.DeleteGuildAsync(Id);
}
}
diff --git a/src/Discord.Net/Models/Roles/Role.cs b/src/Discord.Net/Models/Roles/Role.cs
new file mode 100644
index 000000000..4179c95bd
--- /dev/null
+++ b/src/Discord.Net/Models/Roles/Role.cs
@@ -0,0 +1,50 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Threading.Tasks;
+using Wumpus.Entities;
+using Model = Wumpus.Entities.Role;
+
+namespace Discord
+{
+ internal class Role : SnowflakeEntity, IRole
+ {
+ public Role(Model model, IGuild guild, IDiscordClient discord) : base(discord)
+ {
+ Guild = guild;
+
+ Color = model.Color;
+ IsHoisted = model.IsHoisted;
+ IsManaged = model.Managed;
+ IsMentionable = model.IsMentionable;
+ Name = model.Name.ToString();
+ Permissions = model.Permissions;
+ Position = model.Position;
+ }
+
+ public IGuild Guild { get; set; }
+
+ public Color Color { get; set; }
+ public bool IsHoisted { get; set; }
+ public bool IsManaged { get; set; }
+ public bool IsMentionable { get; set; }
+ public string Name { get; set; }
+ public GuildPermissions Permissions { get; set; }
+ public int Position { get; set; }
+ public string Mention => throw new NotImplementedException(); // TODO: MentionUtils
+
+ public Task DeleteAsync()
+ => Discord.Rest.DeleteGuildRoleAsync(Guild.Id, Id);
+
+ public Task ModifyAsync()
+ {
+ throw new NotImplementedException();
+ }
+
+ // IComparable
+ public int CompareTo(IRole other)
+ {
+ return Id.CompareTo(other.Id);
+ }
+ }
+}
diff --git a/test/Discord.Tests.Integration/Discord.Tests.Integration.csproj b/test/Discord.Tests.Integration/Discord.Tests.Integration.csproj
index 4ec64e7cb..9d091e94e 100644
--- a/test/Discord.Tests.Integration/Discord.Tests.Integration.csproj
+++ b/test/Discord.Tests.Integration/Discord.Tests.Integration.csproj
@@ -4,6 +4,8 @@
netcoreapp2.1
false
+
+ 7.1
diff --git a/test/Discord.Tests.Unit/Discord.Tests.Unit.csproj b/test/Discord.Tests.Unit/Discord.Tests.Unit.csproj
index 269fed778..89023486a 100644
--- a/test/Discord.Tests.Unit/Discord.Tests.Unit.csproj
+++ b/test/Discord.Tests.Unit/Discord.Tests.Unit.csproj
@@ -4,6 +4,8 @@
netcoreapp2.1
false
+
+ 7.1