Browse Source

Merge branch 'docs/faq-n-patches' of https://github.com/Still34/Discord.Net into docs/faq-n-patches

pull/988/head
Hsu Still 7 years ago
parent
commit
31b4e64159
79 changed files with 344 additions and 165 deletions
  1. +2
    -1
      docs/docfx.json
  2. +51
    -52
      docs/guides/commands/commands.md
  3. +1
    -1
      docs/guides/commands/samples/command_handler.cs
  4. +1
    -1
      docs/guides/commands/samples/dependency_map_setup.cs
  5. +3
    -3
      docs/guides/commands/samples/dependency_module.cs
  6. +13
    -9
      docs/guides/commands/samples/module.cs
  7. +1
    -1
      docs/guides/commands/samples/require_owner.cs
  8. +1
    -1
      docs/guides/commands/samples/typereader.cs
  9. +1
    -1
      src/Discord.Net.Commands/Attributes/CommandAttribute.cs
  10. +1
    -0
      src/Discord.Net.Commands/Attributes/DontAutoLoadAttribute.cs
  11. +1
    -0
      src/Discord.Net.Commands/Attributes/DontInjectAttribute.cs
  12. +2
    -2
      src/Discord.Net.Commands/Attributes/Preconditions/RequireBotPermissionAttribute.cs
  13. +1
    -1
      src/Discord.Net.Commands/Attributes/Preconditions/RequireContextAttribute.cs
  14. +1
    -1
      src/Discord.Net.Commands/Attributes/Preconditions/RequireNsfwAttribute.cs
  15. +1
    -1
      src/Discord.Net.Commands/Attributes/Preconditions/RequireOwnerAttribute.cs
  16. +1
    -1
      src/Discord.Net.Commands/Attributes/Preconditions/RequireUserPermissionAttribute.cs
  17. +2
    -2
      src/Discord.Net.Commands/Attributes/PriorityAttribute.cs
  18. +6
    -1
      src/Discord.Net.Core/ConnectionState.cs
  19. +5
    -7
      src/Discord.Net.Core/Entities/Activities/ActivityType.cs
  20. +3
    -0
      src/Discord.Net.Core/Entities/Activities/Game.cs
  21. +1
    -1
      src/Discord.Net.Core/Entities/Activities/GameAsset.cs
  22. +1
    -1
      src/Discord.Net.Core/Entities/Activities/GameTimestamps.cs
  23. +4
    -1
      src/Discord.Net.Core/Entities/Activities/IActivity.cs
  24. +9
    -0
      src/Discord.Net.Core/Entities/Activities/SpotifyGame.cs
  25. +5
    -2
      src/Discord.Net.Core/Entities/Activities/StreamingGame.cs
  26. +1
    -0
      src/Discord.Net.Core/Entities/CacheMode.cs
  27. +5
    -1
      src/Discord.Net.Core/Entities/Channels/Direction.cs
  28. +2
    -1
      src/Discord.Net.Core/Entities/Guilds/DefaultMessageNotifications.cs
  29. +1
    -1
      src/Discord.Net.Core/Entities/Guilds/GuildEmbedProperties.cs
  30. +5
    -1
      src/Discord.Net.Core/Entities/Guilds/GuildIntegrationProperties.cs
  31. +2
    -1
      src/Discord.Net.Core/Entities/Guilds/MfaLevel.cs
  32. +4
    -1
      src/Discord.Net.Core/Entities/Guilds/PermissionTarget.cs
  33. +2
    -1
      src/Discord.Net.Core/Entities/Guilds/VerificationLevel.cs
  34. +2
    -1
      src/Discord.Net.Core/Entities/IDeletable.cs
  35. +2
    -1
      src/Discord.Net.Core/Entities/IMentionable.cs
  36. +1
    -0
      src/Discord.Net.Core/Entities/ISnowflakeEntity.cs
  37. +2
    -1
      src/Discord.Net.Core/Entities/IUpdateable.cs
  38. +1
    -1
      src/Discord.Net.Core/Entities/ImageFormat.cs
  39. +14
    -1
      src/Discord.Net.Core/Entities/Messages/Embed.cs
  40. +6
    -1
      src/Discord.Net.Core/Entities/Messages/EmbedAuthor.cs
  41. +2
    -4
      src/Discord.Net.Core/Entities/Messages/EmbedBuilder.cs
  42. +5
    -1
      src/Discord.Net.Core/Entities/Messages/EmbedField.cs
  43. +5
    -1
      src/Discord.Net.Core/Entities/Messages/EmbedFooter.cs
  44. +6
    -1
      src/Discord.Net.Core/Entities/Messages/EmbedImage.cs
  45. +4
    -1
      src/Discord.Net.Core/Entities/Messages/EmbedProvider.cs
  46. +6
    -1
      src/Discord.Net.Core/Entities/Messages/EmbedThumbnail.cs
  47. +10
    -0
      src/Discord.Net.Core/Entities/Messages/EmbedType.cs
  48. +5
    -1
      src/Discord.Net.Core/Entities/Messages/EmbedVideo.cs
  49. +8
    -8
      src/Discord.Net.Core/Entities/Messages/IAttachment.cs
  50. +15
    -1
      src/Discord.Net.Core/Entities/Messages/IEmbed.cs
  51. +2
    -1
      src/Discord.Net.Core/Entities/Messages/IMessage.cs
  52. +3
    -1
      src/Discord.Net.Core/Entities/Messages/IReaction.cs
  53. +2
    -1
      src/Discord.Net.Core/Entities/Messages/IUserMessage.cs
  54. +1
    -1
      src/Discord.Net.Core/Entities/Messages/MessageProperties.cs
  55. +5
    -0
      src/Discord.Net.Core/Entities/Messages/MessageSource.cs
  56. +9
    -1
      src/Discord.Net.Core/Entities/Messages/MessageType.cs
  57. +4
    -3
      src/Discord.Net.Core/Entities/Messages/ReactionMetadata.cs
  58. +10
    -2
      src/Discord.Net.Core/Entities/Messages/TagHandling.cs
  59. +8
    -1
      src/Discord.Net.Core/Entities/Messages/TagType.cs
  60. +1
    -0
      src/Discord.Net.Core/Entities/Permissions/ChannelPermission.cs
  61. +2
    -1
      src/Discord.Net.Core/Entities/Permissions/GuildPermission.cs
  62. +5
    -1
      src/Discord.Net.Core/Entities/Permissions/PermValue.cs
  63. +1
    -0
      src/Discord.Net.Core/Entities/Roles/Color.cs
  64. +4
    -3
      src/Discord.Net.Core/Entities/Roles/ReorderRoleProperties.cs
  65. +8
    -8
      src/Discord.Net.Core/Entities/Roles/RoleProperties.cs
  66. +2
    -1
      src/Discord.Net.Core/Entities/Users/IGroupUser.cs
  67. +2
    -2
      src/Discord.Net.Core/Entities/Users/IGuildUser.cs
  68. +3
    -2
      src/Discord.Net.Core/Entities/Users/IPresence.cs
  69. +2
    -1
      src/Discord.Net.Core/Entities/Users/ISelfUser.cs
  70. +1
    -0
      src/Discord.Net.Core/Entities/Users/IUser.cs
  71. +2
    -1
      src/Discord.Net.Core/Entities/Users/IWebhookUser.cs
  72. +2
    -2
      src/Discord.Net.Core/Entities/Users/SelfUserProperties.cs
  73. +8
    -1
      src/Discord.Net.Core/Entities/Users/UserStatus.cs
  74. +6
    -6
      src/Discord.Net.Core/Entities/Webhooks/WebhookProperties.cs
  75. +8
    -1
      src/Discord.Net.Core/Extensions/DiscordClientExtensions.cs
  76. +1
    -0
      src/Discord.Net.Core/Extensions/EmbedBuilderExtensions.cs
  77. +1
    -0
      src/Discord.Net.Core/Logging/LogSeverity.cs
  78. +6
    -1
      src/Discord.Net.Core/LoginState.cs
  79. +1
    -0
      src/Discord.Net.Core/TokenType.cs

+ 2
- 1
docs/docfx.json View File

@@ -61,6 +61,7 @@
"_appFooter": "Discord.Net (c) 2015-2018",
"_enableSearch": true
},
"noLangKeyword": false
"noLangKeyword": false,
"xrefService": [ "https://xref.docs.microsoft.com/query?uid={uid}" ]
}
}

+ 51
- 52
docs/guides/commands/commands.md View File

@@ -1,15 +1,15 @@
# The Command Service

[Discord.Commands](xref:Discord.Commands) provides an Attribute-based
[Discord.Commands](xref:Discord.Commands) provides an attribute-based
command parser.

## Setup

To use Commands, you must create a [Command Service] and a Command
To use Commands, you must create a [Command Service] and a command
Handler.

Included below is a very barebone Command Handler. You can extend your
Command Handler as much as you like; however, the below is the bare
Included below is a very barebone command handler. You can extend your
command Handler as much as you like; however, the below is the bare
minimum.

The `CommandService` will optionally accept a [CommandServiceConfig],
@@ -24,8 +24,8 @@ values.

## With Attributes

In 1.0, Commands can be defined ahead of time with attributes, or at
runtime with builders.
Starting from 1.0, Commands can be defined ahead of time with
attributes, or at runtime with builders.

For most bots, ahead-of-time Commands should be all you need, and this
is the recommended method of defining Commands.
@@ -39,23 +39,24 @@ Commands in different classes and have them automatically loaded.

Discord.Net's implementation of Modules is influenced heavily from
ASP.NET Core's Controller pattern. This means that the lifetime of a
module instance is only as long as the Command is being invoked.
module instance is only as long as the command is being invoked.

**Avoid using long-running code** in your modules wherever possible.
You should **not** be implementing very much logic into your modules,
instead, outsource to a service for that.

If you are unfamiliar with Inversion of Control, it is recommended to
read the MSDN article on [IoC] and [Dependency Injection].

To begin, create a new class somewhere in your project and inherit the
class from [ModuleBase]. This class **must** be `public`.
> [!WARNING]
> **Avoid using long-running code** in your modules wherever possible.
> You should **not** be implementing very much logic into your
> modules, instead, outsource to a service for that.
>
> If you are unfamiliar with Inversion of Control, it is recommended
> to read the MSDN article on [IoC] and [Dependency Injection].

>[!NOTE]
>[ModuleBase] is an _abstract_ class, meaning that you may extend it
>or override it as you see fit. Your module may inherit from any
>extension of ModuleBase.

To begin, create a new class somewhere in your project and inherit the
class from [ModuleBase]. This class **must** be `public`.

By now, your module should look like this:

[!code-csharp[Empty Module](samples/empty-module.cs)]
@@ -66,36 +67,36 @@ By now, your module should look like this:

### Adding Commands

The next step to creating Commands is actually creating the Commands.
The next step to creating commands is actually creating the commands.

To create a Command, add a method to your module of type `Task`.
To create a command, add a method to your module of type `Task` or
`Task<RuntimeResult>` depending on your use.
Typically, you will want to mark this method as `async`, although it
is not required.

Adding parameters to a Command is done by adding parameters to the
parent Task.

For example, to take an integer as an argument from the user, add `int
arg`; to take a user as an argument from the user, add `IUser user`.
In 1.0, a Command can accept nearly any type of argument; a full list
of types that are parsed by default can be found in the below section
on _Type Readers_.
Adding parameters to a command is done by adding parameters to the
parent Task. For example, to take an integer as an argument from
the user, add `int arg`; to take a user as an argument from the
user, add `IUser user`. Starting from 1.0, a command can accept
nearly any type of argument; a full list of types that are parsed
by default can be found in the below
section on [Type Readers](#type-readers).

Parameters, by default, are always required. To make a parameter
optional, give it a default value. To accept a comma-separated list,
set the parameter to `params Type[]`.

Should a parameter include spaces, it **must** be wrapped in quotes.
For example, for a Command with a parameter `string food`, you would
execute it with `!favoritefood "Key Lime Pie"`.
If you would like a parameter to parse until the end of a Command,
flag the parameter with the [RemainderAttribute]. This will allow a
user to invoke a Command without wrapping a parameter in quotes.
Should a parameter include spaces, the parameter **must** be
wrapped in quotes. For example, for a command with a parameter
`string food`, you would execute it with
`!favoritefood "Key Lime Pie"`. If you would like a parameter to
parse until the end of a command, flag the parameter with the
[RemainderAttribute]. This will allow a user to invoke a command
without wrapping a parameter in quotes.

Finally, flag your Command with the [CommandAttribute]. (you must
specify a name for this Command, except for when it is part of a
Module Group - see below)
Finally, flag your command with the [CommandAttribute] (you must
specify a name for this command, except for when it is part of a
[Module Group](#module-groups).

[RemainderAttribute]: xref:Discord.Commands.RemainderAttribute
[CommandAttribute]: xref:Discord.Commands.CommandAttribute
@@ -114,11 +115,10 @@ priority will be called first.

### Command Context

Every Command can access the execution context through the [Context]
Every command can access the execution context through the [Context]
property on [ModuleBase]. `ICommandContext` allows you to access the
message, channel, guild, and user that the Command was invoked from,
as well as the underlying Discord client that the Command was invoked
from.
message, channel, guild, user, and the underlying Discord client
that the command was invoked from.

Different types of Contexts may be specified using the generic variant
of [ModuleBase]. When using a [SocketCommandContext], for example, the
@@ -132,7 +132,7 @@ accessing the channel through the [Context] and sending a message.
>Contexts should **NOT** be mixed! You cannot have one module that
>uses `CommandContext` and another that uses `SocketCommandContext`.

[Context]: xref:Discord.Commands.ModuleBase`1#Discord_Commands_ModuleBase_1_Context
[Context]: xref:Discord.Commands.ModuleBase`1.Context
[SocketCommandContext]: xref:Discord.Commands.SocketCommandContext
[ReplyAsync]: xref:Discord.Commands.ModuleBase`1.ReplyAsync*

@@ -144,14 +144,13 @@ At this point, your module should look comparable to this example:
#### Loading Modules Automatically

The Command Service can automatically discover all classes in an
Assembly that inherit [ModuleBase] and load them.
Assembly that inherit [ModuleBase] and load them. Invoke
[CommandService.AddModulesAsync] to discover modules and
install them.

To opt a module out of auto-loading, flag it with
[DontAutoLoadAttribute].

Invoke [CommandService.AddModulesAsync] to discover modules and
install them.

[DontAutoLoadAttribute]: xref:Discord.Commands.DontAutoLoadAttribute
[CommandService.AddModulesAsync]: xref:Discord.Commands.CommandService.AddModulesAsync*

@@ -187,7 +186,7 @@ prefixed. To create a group, flag a module with the

Module groups also allow you to create **nameless Commands**, where
the [CommandAttribute] is configured with no name. In this case, the
Command will inherit the name of the group it belongs to.
command will inherit the name of the group it belongs to.

### Submodules

@@ -209,20 +208,19 @@ DI when writing your modules.

### Setup

First, you need to create an @System.IServiceProvider; you may create
your own one if you wish.
First, you need to create an @System.IServiceProvider.

Next, add the dependencies that your modules will use to the map.
Next, add the dependencies to the service collection that you wish
to use in the Modules.

Finally, pass the map into the `LoadAssembly` method. Your modules
will be automatically loaded with this dependency map.
Finally, pass the service collection into `AddModulesAsync`.

[!code-csharp[IServiceProvider Setup](samples/dependency_map_setup.cs)]

### Usage in Modules

In the constructor of your Module, any parameters will be filled in by
the @System.IServiceProvider that you've passed into `LoadAssembly`.
the @System.IServiceProvider that you've passed.

Any publicly settable properties will also be filled in the same
manner.
@@ -264,6 +262,7 @@ usages on their respective API pages.
- @Discord.Commands.RequireOwnerAttribute
- @Discord.Commands.RequireBotPermissionAttribute
- @Discord.Commands.RequireUserPermissionAttribute
- @Discord.Commands.RequireNsfwAttribute

## Custom Preconditions



+ 1
- 1
docs/guides/commands/samples/command_handler.cs View File

@@ -40,7 +40,7 @@ public class Program
// Hook the MessageReceived Event into our Command Handler
_client.MessageReceived += HandleCommandAsync;
// Discover all of the commands in this assembly and load them.
await _commands.AddModulesAsync(Assembly.GetEntryAssembly());
await _commands.AddModulesAsync(Assembly.GetEntryAssembly(), _services);
}

private async Task HandleCommandAsync(SocketMessage messageParam)


+ 1
- 1
docs/guides/commands/samples/dependency_map_setup.cs View File

@@ -14,5 +14,5 @@ public async Task InstallAsync(DiscordSocketClient client)
.AddSingleton<DatabaseService>()
.BuildServiceProvider();
// ...
await _commands.AddModulesAsync(Assembly.GetEntryAssembly());
await _commands.AddModulesAsync(Assembly.GetEntryAssembly(), _services);
}

+ 3
- 3
docs/guides/commands/samples/dependency_module.cs View File

@@ -2,7 +2,7 @@ using Discord;
using Discord.Commands;
using Discord.WebSocket;

public class ModuleA : ModuleBase
public class ModuleA : ModuleBase<SocketCommandContext>
{
private readonly DatabaseService _database;

@@ -19,11 +19,11 @@ public class ModuleA : ModuleBase
}
}

public class ModuleB
public class ModuleB : ModuleBase<SocketCommandContext>
{

// Public settable properties will be injected
public AnnounceService { get; set; }
public AnnounceService Announce { get; set; }

// Public properties without setters will not
public CommandService Commands { get; }


+ 13
- 9
docs/guides/commands/samples/module.cs View File

@@ -1,14 +1,13 @@
// Create a module with no prefix
public class Info : ModuleBase<SocketCommandContext>
{
// ~say hello -> hello
// ~say hello world -> hello world
[Command("say")]
[Summary("Echoes a message.")]
public async Task SayAsync([Remainder] [Summary("The text to echo")] string echo)
{
// ReplyAsync is a method on ModuleBase
await ReplyAsync(echo);
}
public Task SayAsync([Remainder] [Summary("The text to echo")] string echo)
=> ReplyAsync(echo);
// ReplyAsync is a method on ModuleBase
}

// Create a module with the 'sample' prefix
@@ -18,7 +17,9 @@ public class Sample : ModuleBase<SocketCommandContext>
// ~sample square 20 -> 400
[Command("square")]
[Summary("Squares a number.")]
public async Task SquareAsync([Summary("The number to square.")] int num)
public async Task SquareAsync(
[Summary("The number to square.")]
int num)
{
// We can also access the channel from the Command Context.
await Context.Channel.SendMessageAsync($"{num}^2 = {Math.Pow(num, 2)}");
@@ -31,9 +32,12 @@ public class Sample : ModuleBase<SocketCommandContext>
// ~sample userinfo 96642168176807936 --> Khionu#8708
// ~sample whois 96642168176807936 --> Khionu#8708
[Command("userinfo")]
[Summary("Returns info about the current user, or the user parameter, if one passed.")]
[Summary
("Returns info about the current user, or the user parameter, if one passed.")]
[Alias("user", "whois")]
public async Task UserInfoAsync([Summary("The (optional) user to get info for")] SocketUser user = null)
public async Task UserInfoAsync(
[Summary("The (optional) user to get info for")]
SocketUser user = null)
{
var userInfo = user ?? Context.Client.CurrentUser;
await ReplyAsync($"{userInfo.Username}#{userInfo.Discriminator}");


+ 1
- 1
docs/guides/commands/samples/require_owner.cs View File

@@ -10,7 +10,7 @@ using System.Threading.Tasks;
public class RequireOwnerAttribute : PreconditionAttribute
{
// Override the CheckPermissions method
public async override Task<PreconditionResult> CheckPermissions(ICommandContext context, CommandInfo command, IServiceProvider services)
public async override Task<PreconditionResult> CheckPermissionsAsync(ICommandContext context, CommandInfo command, IServiceProvider services)
{
// Get the ID of the bot's owner
var ownerId = (await services.GetService<DiscordSocketClient>().GetApplicationInfoAsync()).Owner.Id;


+ 1
- 1
docs/guides/commands/samples/typereader.cs View File

@@ -4,7 +4,7 @@ using Discord.Commands;

public class BooleanTypeReader : TypeReader
{
public override Task<TypeReaderResult> Read(ICommandContext context, string input, IServiceProvider services)
public override Task<TypeReaderResult> ReadAsync(ICommandContext context, string input, IServiceProvider services)
{
bool result;
if (bool.TryParse(input, out result))


+ 1
- 1
src/Discord.Net.Commands/Attributes/CommandAttribute.cs View File

@@ -7,7 +7,7 @@ namespace Discord.Commands
public class CommandAttribute : Attribute
{
/// <summary>
/// Specifies the text required to be recognized as a command.
/// Gets the text that has been set to be recognized as a command.
/// </summary>
public string Text { get; }
/// <summary>


+ 1
- 0
src/Discord.Net.Commands/Attributes/DontAutoLoadAttribute.cs View File

@@ -2,6 +2,7 @@ using System;

namespace Discord.Commands
{
/// <summary> Prevents the module from being loaded automatically. </summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
public class DontAutoLoadAttribute : Attribute
{


+ 1
- 0
src/Discord.Net.Commands/Attributes/DontInjectAttribute.cs View File

@@ -2,6 +2,7 @@ using System;

namespace Discord.Commands {

/// <summary> Prevents the property from being injected into a module. </summary>
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
public class DontInjectAttribute : Attribute {
}


+ 2
- 2
src/Discord.Net.Commands/Attributes/Preconditions/RequireBotPermissionAttribute.cs View File

@@ -4,7 +4,7 @@ using System.Threading.Tasks;
namespace Discord.Commands
{
/// <summary>
/// This attribute requires the bot to have a specific permission in the channel a command is invoked in.
/// Requires the bot to have a specific permission in the channel a command is invoked in.
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
public class RequireBotPermissionAttribute : PreconditionAttribute
@@ -13,7 +13,7 @@ namespace Discord.Commands
public ChannelPermission? ChannelPermission { get; }

/// <summary>
/// Requires that the bot account to have a specific <see cref="GuildPermission"/>.
/// Requires the bot account to have a specific <see cref="GuildPermission"/>.
/// </summary>
/// <remarks>This precondition will always fail if the command is being invoked in a private channel.</remarks>
/// <param name="permission">The GuildPermission that the bot must have. Multiple permissions can be specified by ORing the permissions together.</param>


+ 1
- 1
src/Discord.Net.Commands/Attributes/Preconditions/RequireContextAttribute.cs View File

@@ -13,7 +13,7 @@ namespace Discord.Commands
}

/// <summary>
/// This attribute requires that the command be invoked in a specified context. (e.g. in guild, DM)
/// Requires the command to be invoked in a specified context. (e.g. in guild, DM)
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
public class RequireContextAttribute : PreconditionAttribute


+ 1
- 1
src/Discord.Net.Commands/Attributes/Preconditions/RequireNsfwAttribute.cs View File

@@ -4,7 +4,7 @@ using System.Threading.Tasks;
namespace Discord.Commands
{
/// <summary>
/// This attribute requires that the command to be invoked in a channel marked NSFW.
/// Requires the command to be invoked in a channel marked NSFW.
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
public class RequireNsfwAttribute : PreconditionAttribute


+ 1
- 1
src/Discord.Net.Commands/Attributes/Preconditions/RequireOwnerAttribute.cs View File

@@ -4,7 +4,7 @@ using System.Threading.Tasks;
namespace Discord.Commands
{
/// <summary>
/// This attribute requires that the command to be invoked by the owner of the bot.
/// Requires the command to be invoked by the owner of the bot.
/// </summary>
/// <remarks>This precondition will only work if the bot is a bot account.</remarks>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = true)]


+ 1
- 1
src/Discord.Net.Commands/Attributes/Preconditions/RequireUserPermissionAttribute.cs View File

@@ -4,7 +4,7 @@ using System.Threading.Tasks;
namespace Discord.Commands
{
/// <summary>
/// This attribute requires that the user invoking the command has a specified permission.
/// Requires the user invoking the command to have a specified permission.
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
public class RequireUserPermissionAttribute : PreconditionAttribute


+ 2
- 2
src/Discord.Net.Commands/Attributes/PriorityAttribute.cs View File

@@ -2,11 +2,11 @@ using System;

namespace Discord.Commands
{
/// <summary> Sets priority of commands </summary>
/// <summary> Sets priority of commands. </summary>
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public class PriorityAttribute : Attribute
{
/// <summary> The priority which has been set for the command </summary>
/// <summary> Gets the priority which has been set for the command. </summary>
public int Priority { get; }

/// <summary> Creates a new <see cref="PriorityAttribute"/> with the given priority. </summary>


+ 6
- 1
src/Discord.Net.Core/ConnectionState.cs View File

@@ -1,10 +1,15 @@
namespace Discord
namespace Discord
{
/// <summary> Specifies the connection state of a client. </summary>
public enum ConnectionState : byte
{
/// <summary> Represents that the client has disconnected from the WebSocket. </summary>
Disconnected,
/// <summary> Represents that the client is connecting to the WebSocket. </summary>
Connecting,
/// <summary> Represents that the client has established a connection to the WebSocket. </summary>
Connected,
/// <summary> Represents that the client is disconnecting from the WebSocket. </summary>
Disconnecting
}
}

+ 5
- 7
src/Discord.Net.Core/Entities/Activities/ActivityType.cs View File

@@ -1,17 +1,15 @@
namespace Discord
{
/// <summary>
/// Defines user's activity type.
/// </summary>
/// <summary> Specifies a Discord user's activity type. </summary>
public enum ActivityType
{
/// <summary> Activity that represents a user that is playing a game. </summary>
/// <summary> Represents that the user is playing a game. </summary>
Playing = 0,
/// <summary> Activity that represents a user that is streaming online. </summary>
/// <summary> Represents that the user is streaming online. </summary>
Streaming = 1,
/// <summary> Activity that represents a user that is listening to a song. </summary>
/// <summary> Represents that the user is listening to a song. </summary>
Listening = 2,
/// <summary> Activity that represents a user that is watching a media. </summary>
/// <summary> Represents that the user is watching a media. </summary>
Watching = 3
}
}

+ 3
- 0
src/Discord.Net.Core/Entities/Activities/Game.cs View File

@@ -2,10 +2,13 @@ using System.Diagnostics;

namespace Discord
{
/// <summary> A user's game activity. </summary>
[DebuggerDisplay(@"{DebuggerDisplay,nq}")]
public class Game : IActivity
{
/// <inheritdoc/>
public string Name { get; internal set; }
/// <inheritdoc/>
public ActivityType Type { get; internal set; }

internal Game() { }


+ 1
- 1
src/Discord.Net.Core/Entities/Activities/GameAsset.cs View File

@@ -1,6 +1,6 @@
namespace Discord
{
/// <summary> The asset for a <see cref="RichGame"/> object. </summary>
/// <summary> An asset for a <see cref="RichGame"/> object. </summary>
public class GameAsset
{
internal GameAsset() { }


+ 1
- 1
src/Discord.Net.Core/Entities/Activities/GameTimestamps.cs View File

@@ -2,7 +2,7 @@ using System;

namespace Discord
{
/// <summary> The timestamps for a <see cref="RichGame"/> object. </summary>
/// <summary> Timestamps for a <see cref="RichGame"/> object. </summary>
public class GameTimestamps
{
public DateTimeOffset? Start { get; }


+ 4
- 1
src/Discord.Net.Core/Entities/Activities/IActivity.cs View File

@@ -1,8 +1,11 @@
namespace Discord
namespace Discord
{
/// <summary> A Discord activity. </summary>
public interface IActivity
{
/// <summary> Gets the name of the activity. </summary>
string Name { get; }
/// <summary> Gets the type of the activity. </summary>
ActivityType Type { get; }
}
}

+ 9
- 0
src/Discord.Net.Core/Entities/Activities/SpotifyGame.cs View File

@@ -4,19 +4,28 @@ using System.Diagnostics;

namespace Discord
{
/// <summary> A user's activity for listening to a song on Spotify. </summary>
[DebuggerDisplay(@"{DebuggerDisplay,nq}")]
public class SpotifyGame : Game
{
/// <summary> Gets the song's artist(s). </summary>
public IEnumerable<string> Artists { get; internal set; }
/// <summary> Gets the Spotify album art for the song. </summary>
public string AlbumArt { get; internal set; }
/// <summary> Gets the Spotify album title for the song. </summary>
public string AlbumTitle { get; internal set; }
/// <summary> Gets the track title for the song. </summary>
public string TrackTitle { get; internal set; }
/// <summary> Gets the synchronization ID for the song. </summary>
public string SyncId { get; internal set; }
/// <summary> Gets the session ID for the song. </summary>
public string SessionId { get; internal set; }
/// <summary> Gets the duration for the song. </summary>
public TimeSpan? Duration { get; internal set; }

internal SpotifyGame() { }

/// <summary> Gets the name of the song. </summary>
public override string ToString() => Name;
private string DebuggerDisplay => $"{Name} (Spotify)";
}


+ 5
- 2
src/Discord.Net.Core/Entities/Activities/StreamingGame.cs View File

@@ -1,10 +1,12 @@
using System.Diagnostics;
using System.Diagnostics;

namespace Discord
{
/// <summary> A user's activity for streaming on services such as Twitch. </summary>
[DebuggerDisplay(@"{DebuggerDisplay,nq}")]
public class StreamingGame : Game
{
/// <summary> Gets the URL of the stream. </summary>
public string Url { get; internal set; }

public StreamingGame(string name, string url)
@@ -14,7 +16,8 @@ namespace Discord
Type = ActivityType.Streaming;
}

/// <summary> Gets the name of the stream. </summary>
public override string ToString() => Name;
private string DebuggerDisplay => $"{Name} ({Url})";
}
}
}

+ 1
- 0
src/Discord.Net.Core/Entities/CacheMode.cs View File

@@ -1,5 +1,6 @@
namespace Discord
{
/// <summary> Specifies the cache mode that should be used. </summary>
public enum CacheMode
{
/// <summary> Allows the object to be downloaded if it does not exist in the current cache. </summary>


+ 5
- 1
src/Discord.Net.Core/Entities/Channels/Direction.cs View File

@@ -1,9 +1,13 @@
namespace Discord
namespace Discord
{
/// <summary> Specifies the direction of where message(s) should be gotten from. </summary>
public enum Direction
{
/// <summary> The message(s) should be retrieved before a message. </summary>
Before,
/// <summary> The message(s) should be retrieved after a message. </summary>
After,
/// <summary> The message(s) should be retrieved around a message. </summary>
Around
}
}

+ 2
- 1
src/Discord.Net.Core/Entities/Guilds/DefaultMessageNotifications.cs View File

@@ -1,5 +1,6 @@
namespace Discord
namespace Discord
{
/// <summary> Specifies the default message notification behavior the guild uses. </summary>
public enum DefaultMessageNotifications
{
/// <summary> By default, all messages will trigger notifications. </summary>


+ 1
- 1
src/Discord.Net.Core/Entities/Guilds/GuildEmbedProperties.cs View File

@@ -1,7 +1,7 @@
namespace Discord
{
/// <summary>
/// Properties that are used to modify the widget of an <see cref="IGuild"/> with the specified parameters.
/// Properties that are used to modify the widget of an <see cref="IGuild"/> with the specified changes.
/// </summary>
public class GuildEmbedProperties
{


+ 5
- 1
src/Discord.Net.Core/Entities/Guilds/GuildIntegrationProperties.cs View File

@@ -1,9 +1,13 @@
namespace Discord
namespace Discord
{
/// <summary> Properties used to modify an <see cref="IGuildIntegration"/> with the specified changes.</summary>
public class GuildIntegrationProperties
{
/// <summary> Gets or sets the behavior when an integration subscription lapses. </summary>
public Optional<int> ExpireBehavior { get; set; }
/// <summary> Gets or sets the period (in seconds) where the integration will ignore lapsed subscriptions. </summary>
public Optional<int> ExpireGracePeriod { get; set; }
/// <summary> Gets or sets whether emoticons should be synced for this integration. </summary>
public Optional<bool> EnableEmoticons { get; set; }
}
}

+ 2
- 1
src/Discord.Net.Core/Entities/Guilds/MfaLevel.cs View File

@@ -1,5 +1,6 @@
namespace Discord
namespace Discord
{
/// <summary> Specifies the guild's Multi-Factor Authentication (MFA) level requirement. </summary>
public enum MfaLevel
{
/// <summary> Users have no additional MFA restriction on this guild. </summary>


+ 4
- 1
src/Discord.Net.Core/Entities/Guilds/PermissionTarget.cs View File

@@ -1,8 +1,11 @@
namespace Discord
namespace Discord
{
/// <summary> Specifies the target of the permission. </summary>
public enum PermissionTarget
{
/// <summary> The target of the permission is a role. </summary>
Role,
/// <summary> The target of the permission is a user. </summary>
User
}
}

+ 2
- 1
src/Discord.Net.Core/Entities/Guilds/VerificationLevel.cs View File

@@ -1,5 +1,6 @@
namespace Discord
namespace Discord
{
/// <summary> Specifies the verification level the guild uses. </summary>
public enum VerificationLevel
{
/// <summary> Users have no additional restrictions on sending messages to this guild. </summary>


+ 2
- 1
src/Discord.Net.Core/Entities/IDeletable.cs View File

@@ -1,7 +1,8 @@
using System.Threading.Tasks;
using System.Threading.Tasks;

namespace Discord
{
/// <summary> Represents whether the object is deletable or not. </summary>
public interface IDeletable
{
/// <summary> Deletes this object and all its children. </summary>


+ 2
- 1
src/Discord.Net.Core/Entities/IMentionable.cs View File

@@ -1,5 +1,6 @@
namespace Discord
namespace Discord
{
/// <summary> Represents whether the object is mentionable or not. </summary>
public interface IMentionable
{
/// <summary> Returns a special string used to mention this object. </summary>


+ 1
- 0
src/Discord.Net.Core/Entities/ISnowflakeEntity.cs View File

@@ -2,6 +2,7 @@ using System;

namespace Discord
{
/// <summary> Represents a Discord snowflake entity. </summary>
public interface ISnowflakeEntity : IEntity<ulong>
{
DateTimeOffset CreatedAt { get; }


+ 2
- 1
src/Discord.Net.Core/Entities/IUpdateable.cs View File

@@ -1,7 +1,8 @@
using System.Threading.Tasks;
using System.Threading.Tasks;

namespace Discord
{
/// <summary> Represents whether the object is updatable or not. </summary>
public interface IUpdateable
{
/// <summary> Updates this object's properties with its current state. </summary>


+ 1
- 1
src/Discord.Net.Core/Entities/ImageFormat.cs View File

@@ -1,6 +1,6 @@
namespace Discord
{
/// <summary> The type of format for the image to return. </summary>
/// <summary> Specifies the type of format the image should return in. </summary>
public enum ImageFormat
{
Auto,


+ 14
- 1
src/Discord.Net.Core/Entities/Messages/Embed.cs View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Linq;
@@ -8,19 +8,32 @@ namespace Discord
[DebuggerDisplay(@"{DebuggerDisplay,nq}")]
public class Embed : IEmbed
{
/// <inheritdoc/>
public EmbedType Type { get; }

/// <inheritdoc/>
public string Description { get; internal set; }
/// <inheritdoc/>
public string Url { get; internal set; }
/// <inheritdoc/>
public string Title { get; internal set; }
/// <inheritdoc/>
public DateTimeOffset? Timestamp { get; internal set; }
/// <inheritdoc/>
public Color? Color { get; internal set; }
/// <inheritdoc/>
public EmbedImage? Image { get; internal set; }
/// <inheritdoc/>
public EmbedVideo? Video { get; internal set; }
/// <inheritdoc/>
public EmbedAuthor? Author { get; internal set; }
/// <inheritdoc/>
public EmbedFooter? Footer { get; internal set; }
/// <inheritdoc/>
public EmbedProvider? Provider { get; internal set; }
/// <inheritdoc/>
public EmbedThumbnail? Thumbnail { get; internal set; }
/// <inheritdoc/>
public ImmutableArray<EmbedField> Fields { get; internal set; }

internal Embed(EmbedType type)


+ 6
- 1
src/Discord.Net.Core/Entities/Messages/EmbedAuthor.cs View File

@@ -1,14 +1,19 @@
using System;
using System;
using System.Diagnostics;

namespace Discord
{
/// <summary> An author field for an <see cref="Embed"/>. </summary>
[DebuggerDisplay("{DebuggerDisplay,nq}")]
public struct EmbedAuthor
{
/// <summary> Gets the name of the author field.</summary>
public string Name { get; internal set; }
/// <summary> Gets the URL of the author field.</summary>
public string Url { get; internal set; }
/// <summary> Gets the icon URL of the author field.</summary>
public string IconUrl { get; internal set; }
/// <summary> Gets the proxified icon URL of the author field.</summary>
public string ProxyIconUrl { get; internal set; }

internal EmbedAuthor(string name, string url, string iconUrl, string proxyIconUrl)


+ 2
- 4
src/Discord.Net.Core/Entities/Messages/EmbedBuilder.cs View File

@@ -1,12 +1,10 @@
using System;
using System;
using System.Collections.Generic;
using System.Collections.Immutable;

namespace Discord
{
/// <summary>
/// Builder for creating an <see cref="Embed"/> to be sent.
/// </summary>
/// <summary> A builder for creating an <see cref="Embed"/> to be sent. </summary>
public class EmbedBuilder
{
private readonly Embed _embed;


+ 5
- 1
src/Discord.Net.Core/Entities/Messages/EmbedField.cs View File

@@ -1,12 +1,16 @@
using System.Diagnostics;
using System.Diagnostics;

namespace Discord
{
/// <summary> A field for an <see cref="Embed"/>. </summary>
[DebuggerDisplay("{DebuggerDisplay,nq}")]
public struct EmbedField
{
/// <summary> Gets the name of the field.</summary>
public string Name { get; internal set; }
/// <summary> Gets the value of the field.</summary>
public string Value { get; internal set; }
/// <summary> Gets whether the field is inline inside an <see cref="Embed"/> or not.</summary>
public bool Inline { get; internal set; }

internal EmbedField(string name, string value, bool inline)


+ 5
- 1
src/Discord.Net.Core/Entities/Messages/EmbedFooter.cs View File

@@ -1,13 +1,17 @@
using System;
using System;
using System.Diagnostics;

namespace Discord
{
/// <summary> A footer field for an <see cref="Embed"/>. </summary>
[DebuggerDisplay("{DebuggerDisplay,nq}")]
public struct EmbedFooter
{
/// <summary> Gets the text of the footer.</summary>
public string Text { get; internal set; }
/// <summary> Gets the icon URL of the footer.</summary>
public string IconUrl { get; internal set; }
/// <summary> Gets the proxified icon URL of the footer.</summary>
public string ProxyUrl { get; internal set; }

internal EmbedFooter(string text, string iconUrl, string proxyUrl)


+ 6
- 1
src/Discord.Net.Core/Entities/Messages/EmbedImage.cs View File

@@ -1,14 +1,19 @@
using System;
using System;
using System.Diagnostics;

namespace Discord
{
/// <summary> An image for an <see cref="Embed"/>. </summary>
[DebuggerDisplay("{DebuggerDisplay,nq}")]
public struct EmbedImage
{
/// <summary> Gets the URL of the image.</summary>
public string Url { get; }
/// <summary> Gets the proxified URL of the image.</summary>
public string ProxyUrl { get; }
/// <summary> Gets the height of the image if any is set. </summary>
public int? Height { get; }
/// <summary> Gets the width of the image if any is set. </summary>
public int? Width { get; }

internal EmbedImage(string url, string proxyUrl, int? height, int? width)


+ 4
- 1
src/Discord.Net.Core/Entities/Messages/EmbedProvider.cs View File

@@ -1,12 +1,15 @@
using System;
using System;
using System.Diagnostics;

namespace Discord
{
/// <summary> A provider field for an <see cref="Embed"/>. </summary>
[DebuggerDisplay("{DebuggerDisplay,nq}")]
public struct EmbedProvider
{
/// <summary> Gets the name of the provider.</summary>
public string Name { get; }
/// <summary> Gets the URL of the provider.</summary>
public string Url { get; }

internal EmbedProvider(string name, string url)


+ 6
- 1
src/Discord.Net.Core/Entities/Messages/EmbedThumbnail.cs View File

@@ -1,14 +1,19 @@
using System;
using System;
using System.Diagnostics;

namespace Discord
{
/// <summary> A thumbnail featured in an <see cref="Embed"/>. </summary>
[DebuggerDisplay("{DebuggerDisplay,nq}")]
public struct EmbedThumbnail
{
/// <summary> Gets the URL of the thumbnail.</summary>
public string Url { get; }
/// <summary> Gets the proxified URL of the thumbnail.</summary>
public string ProxyUrl { get; }
/// <summary> Gets the height of the thumbnail if any is set. </summary>
public int? Height { get; }
/// <summary> Gets the width of the thumbnail if any is set. </summary>
public int? Width { get; }

internal EmbedThumbnail(string url, string proxyUrl, int? height, int? width)


+ 10
- 0
src/Discord.Net.Core/Entities/Messages/EmbedType.cs View File

@@ -1,15 +1,25 @@
namespace Discord
{
/// <summary> Specifies the type of embed. </summary>
public enum EmbedType
{
/// <summary> An unknown embed type. </summary>
Unknown = -1,
/// <summary> A rich embed type. </summary>
Rich,
/// <summary> A link embed type. </summary>
Link,
/// <summary> A video embed type. </summary>
Video,
/// <summary> An image embed type. </summary>
Image,
/// <summary> A GIFV embed type. </summary>
Gifv,
/// <summary> An article embed type. </summary>
Article,
/// <summary> A tweet embed type. </summary>
Tweet,
/// <summary> A HTML embed type. </summary>
Html,
}
}

+ 5
- 1
src/Discord.Net.Core/Entities/Messages/EmbedVideo.cs View File

@@ -1,13 +1,17 @@
using System;
using System;
using System.Diagnostics;

namespace Discord
{
/// <summary> A video featured in an <see cref="Embed"/>. </summary>
[DebuggerDisplay("{DebuggerDisplay,nq}")]
public struct EmbedVideo
{
/// <summary> Gets the URL of the video. </summary>
public string Url { get; }
/// <summary> Gets the height of the video if there is any. </summary>
public int? Height { get; }
/// <summary> Gets the weight of the video if there is any. </summary>
public int? Width { get; }

internal EmbedVideo(string url, int? height, int? width)


+ 8
- 8
src/Discord.Net.Core/Entities/Messages/IAttachment.cs View File

@@ -1,22 +1,22 @@
namespace Discord
{
/// <summary> The interface that defines an attachment object. </summary>
/// <summary> Represents a Discord attachment object. </summary>
public interface IAttachment
{
/// <summary> The snowflake ID of the attachment. </summary>
/// <summary> Gets the snowflake ID of the attachment. </summary>
ulong Id { get; }

/// <summary> The filename of the attachment. </summary>
/// <summary> Gets the filename of the attachment. </summary>
string Filename { get; }
/// <summary> The URL of the attachment. </summary>
/// <summary> Gets the URL of the attachment. </summary>
string Url { get; }
/// <summary> The proxied URL of the attachment. </summary>
/// <summary> Gets the proxied URL of the attachment. </summary>
string ProxyUrl { get; }
/// <summary> The file size of the attachment. </summary>
/// <summary> Gets the file size of the attachment. </summary>
int Size { get; }
/// <summary> The height of the attachment if it is an image, or return <see langword="null"/> when it is not. </summary>
/// <summary> Gets the height of the attachment if it is an image, or return <see langword="null"/> when it is not. </summary>
int? Height { get; }
/// <summary> The width of the attachment if it is an image, or return <see langword="null"/> when it is not. </summary>
/// <summary> Gets the width of the attachment if it is an image, or return <see langword="null"/> when it is not. </summary>
int? Width { get; }
}
}

+ 15
- 1
src/Discord.Net.Core/Entities/Messages/IEmbed.cs View File

@@ -1,22 +1,36 @@
using System;
using System;
using System.Collections.Immutable;

namespace Discord
{
/// <summary> Represents a Discord embed object. </summary>
public interface IEmbed
{
/// <summary> Gets the title URL of the embed. </summary>
string Url { get; }
/// <summary> Gets the title of the embed. </summary>
string Title { get; }
/// <summary> Gets the description of the embed. </summary>
string Description { get; }
/// <summary> Gets the type of the embed. </summary>
EmbedType Type { get; }
/// <summary> Gets the timestamp of the embed. </summary>
DateTimeOffset? Timestamp { get; }
/// <summary> Gets the sidebar color of the embed. </summary>
Color? Color { get; }
/// <summary> Gets the image of the embed. </summary>
EmbedImage? Image { get; }
/// <summary> Gets the video of the embed. </summary>
EmbedVideo? Video { get; }
/// <summary> Gets the author field of the embed. </summary>
EmbedAuthor? Author { get; }
/// <summary> Gets the footer field of the embed. </summary>
EmbedFooter? Footer { get; }
/// <summary> Gets the provider of the embed. </summary>
EmbedProvider? Provider { get; }
/// <summary> Gets the thumbnail featured in the embed. </summary>
EmbedThumbnail? Thumbnail { get; }
/// <summary> Gets the fields of the embed. </summary>
ImmutableArray<EmbedField> Fields { get; }
}
}

+ 2
- 1
src/Discord.Net.Core/Entities/Messages/IMessage.cs View File

@@ -1,8 +1,9 @@
using System;
using System;
using System.Collections.Generic;

namespace Discord
{
/// <summary> Represents a Discord message object. </summary>
public interface IMessage : ISnowflakeEntity, IDeletable
{
/// <summary> Gets the type of this system message. </summary>


+ 3
- 1
src/Discord.Net.Core/Entities/Messages/IReaction.cs View File

@@ -1,7 +1,9 @@
namespace Discord
namespace Discord
{
/// <summary> Represents a Discord reaction object. </summary>
public interface IReaction
{
/// <summary> The <see cref="IEmote"/> used in the reaction. </summary>
IEmote Emote { get; }
}
}

+ 2
- 1
src/Discord.Net.Core/Entities/Messages/IUserMessage.cs View File

@@ -1,9 +1,10 @@
using System;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace Discord
{
/// <summary> A Discord message object. </summary>
public interface IUserMessage : IMessage
{
/// <summary> Modifies this message. </summary>


+ 1
- 1
src/Discord.Net.Core/Entities/Messages/MessageProperties.cs View File

@@ -1,7 +1,7 @@
namespace Discord
{
/// <summary>
/// Properties that are used to modify a message with the specified parameters.
/// Properties that are used to modify an <see cref="IUserMessage"/> with the specified changes.
/// </summary>
/// <remarks>
/// The content of a message can be cleared with String.Empty; if and only if an Embed is present.


+ 5
- 0
src/Discord.Net.Core/Entities/Messages/MessageSource.cs View File

@@ -1,10 +1,15 @@
namespace Discord
{
/// <summary> Specifies the source of the Discord message. </summary>
public enum MessageSource
{
/// <summary> The message is sent by the system. </summary>
System,
/// <summary> The message is sent by a user. </summary>
User,
/// <summary> The message is sent by a bot. </summary>
Bot,
/// <summary> The message is sent by a webhook. </summary>
Webhook
}
}

+ 9
- 1
src/Discord.Net.Core/Entities/Messages/MessageType.cs View File

@@ -1,13 +1,21 @@
namespace Discord
namespace Discord
{
/// <summary> Specifies the type of message. </summary>
public enum MessageType
{
/// <summary> The default message type. </summary>
Default = 0,
/// <summary> The message when a recipient is added. </summary>
RecipientAdd = 1,
/// <summary> The message when a recipient is removed. </summary>
RecipientRemove = 2,
/// <summary> The message when a user is called. </summary>
Call = 3,
/// <summary> The message when a channel name is changed. </summary>
ChannelNameChange = 4,
/// <summary> The message when a channel icon is changed. </summary>
ChannelIconChange = 5,
/// <summary> The message when another message is pinned. </summary>
ChannelPinnedMessage = 6
}
}

+ 4
- 3
src/Discord.Net.Core/Entities/Messages/ReactionMetadata.cs View File

@@ -1,11 +1,12 @@
namespace Discord
namespace Discord
{
/// <summary> A metadata containing reaction information. </summary>
public struct ReactionMetadata
{
/// <summary> Gets the number of reactions </summary>
/// <summary> Gets the number of reactions. </summary>
public int ReactionCount { get; internal set; }

/// <summary> Returns true if the current user has used this reaction </summary>
/// <summary> Returns true if the current user has used this reaction. </summary>
public bool IsMe { get; internal set; }
}
}

+ 10
- 2
src/Discord.Net.Core/Entities/Messages/TagHandling.cs View File

@@ -1,13 +1,21 @@
namespace Discord
namespace Discord
{
/// <summary> Specifies the handling type the tag should use. </summary>
public enum TagHandling
{
/// <summary> Tag handling is ignored. </summary>
Ignore = 0, //<@53905483156684800> -> <@53905483156684800>
Remove, //<@53905483156684800> ->
/// <summary> Removes the tag entirely. </summary>
Remove, //<@53905483156684800> ->
/// <summary> Resolves to username (e.g. @User). </summary>
Name, //<@53905483156684800> -> @Voltana
/// <summary> Resolves to username without mention prefix (e.g. User). </summary>
NameNoPrefix, //<@53905483156684800> -> Voltana
/// <summary> Resolves to username with discriminator value. (e.g. @User#0001). </summary>
FullName, //<@53905483156684800> -> @Voltana#8252
/// <summary> Resolves to username with discriminator value without mention prefix. (e.g. User#0001). </summary>
FullNameNoPrefix, //<@53905483156684800> -> Voltana#8252
/// <summary> Sanitizes the tag. </summary>
Sanitize //<@53905483156684800> -> <@53905483156684800> (w/ nbsp)
}
}

+ 8
- 1
src/Discord.Net.Core/Entities/Messages/TagType.cs View File

@@ -1,12 +1,19 @@
namespace Discord
namespace Discord
{
/// <summary> Specifies the type of Discord tag. </summary>
public enum TagType
{
/// <summary> The object is an user mention. </summary>
UserMention,
/// <summary> The object is a channel mention. </summary>
ChannelMention,
/// <summary> The object is a role mention. </summary>
RoleMention,
/// <summary> The object is an everyone mention. </summary>
EveryoneMention,
/// <summary> The object is a here mention. </summary>
HereMention,
/// <summary> The object is an emoji. </summary>
Emoji
}
}

+ 1
- 0
src/Discord.Net.Core/Entities/Permissions/ChannelPermission.cs View File

@@ -2,6 +2,7 @@ using System;

namespace Discord
{
/// <summary> Defines the available permissions for a channel. </summary>
[FlagsAttribute]
public enum ChannelPermission : ulong
{


+ 2
- 1
src/Discord.Net.Core/Entities/Permissions/GuildPermission.cs View File

@@ -1,7 +1,8 @@
using System;
using System;

namespace Discord
{
/// <summary> Defines the available permissions for a channel. </summary>
[FlagsAttribute]
public enum GuildPermission : ulong
{


+ 5
- 1
src/Discord.Net.Core/Entities/Permissions/PermValue.cs View File

@@ -1,9 +1,13 @@
namespace Discord
namespace Discord
{
/// <summary> Specifies the permission value. </summary>
public enum PermValue
{
/// <summary> Allows this permission. </summary>
Allow,
/// <summary> Denies this permission. </summary>
Deny,
/// <summary> Inherits the permission settings. </summary>
Inherit
}
}

+ 1
- 0
src/Discord.Net.Core/Entities/Roles/Color.cs View File

@@ -3,6 +3,7 @@ using System.Diagnostics;

namespace Discord
{
/// <summary> A color object that Discord uses. </summary>
[DebuggerDisplay(@"{DebuggerDisplay,nq}")]
public struct Color
{


+ 4
- 3
src/Discord.Net.Core/Entities/Roles/ReorderRoleProperties.cs View File

@@ -1,10 +1,11 @@
namespace Discord
namespace Discord
{
/// <summary> Properties that are used to reorder an <see cref="IRole"/>. </summary>
public class ReorderRoleProperties
{
/// <summary>The id of the role to be edited</summary>
/// <summary> Gets the ID of the role to be edited. </summary>
public ulong Id { get; }
/// <summary>The new zero-based position of the role.</summary>
/// <summary> Gets the new zero-based position of the role. </summary>
public int Position { get; }

public ReorderRoleProperties(ulong id, int pos)


+ 8
- 8
src/Discord.Net.Core/Entities/Roles/RoleProperties.cs View File

@@ -1,7 +1,7 @@
namespace Discord
namespace Discord
{
/// <summary>
/// Modify an IRole with the specified parameters
/// Properties that are used to modify an <see cref="IRole"/> with the specified changes.
/// </summary>
/// <example>
/// <code language="c#">
@@ -16,39 +16,39 @@
public class RoleProperties
{
/// <summary>
/// The name of the role
/// Gets or sets the name of the role.
/// </summary>
/// <remarks>
/// If this role is the EveryoneRole, this value may not be set.
/// </remarks>
public Optional<string> Name { get; set; }
/// <summary>
/// The role's GuildPermissions
/// Gets or sets the role's <see cref="GuildPermission"/>.
/// </summary>
public Optional<GuildPermissions> Permissions { get; set; }
/// <summary>
/// The position of the role. This is 0-based!
/// Gets or sets the position of the role. This is 0-based!
/// </summary>
/// <remarks>
/// If this role is the EveryoneRole, this value may not be set.
/// </remarks>
public Optional<int> Position { get; set; }
/// <summary>
/// The color of the Role.
/// Gets or sets the color of the Role.
/// </summary>
/// <remarks>
/// If this role is the EveryoneRole, this value may not be set.
/// </remarks>
public Optional<Color> Color { get; set; }
/// <summary>
/// Whether or not this role should be displayed independently in the userlist.
/// Gets or sets whether or not this role should be displayed independently in the userlist.
/// </summary>
/// <remarks>
/// If this role is the EveryoneRole, this value may not be set.
/// </remarks>
public Optional<bool> Hoist { get; set; }
/// <summary>
/// Whether or not this role can be mentioned.
/// Gets or sets whether or not this role can be mentioned.
/// </summary>
/// <remarks>
/// If this role is the EveryoneRole, this value may not be set.


+ 2
- 1
src/Discord.Net.Core/Entities/Users/IGroupUser.cs View File

@@ -1,5 +1,6 @@
namespace Discord
namespace Discord
{
/// <summary> Represents a Discord user that is in a group. </summary>
public interface IGroupUser : IUser, IVoiceState
{
///// <summary> Kicks this user from this group. </summary>


+ 2
- 2
src/Discord.Net.Core/Entities/Users/IGuildUser.cs View File

@@ -1,10 +1,10 @@
using System;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace Discord
{
/// <summary> A Guild-User pairing. </summary>
/// <summary> Represents a Discord user that is in a guild. </summary>
public interface IGuildUser : IUser, IVoiceState
{
/// <summary> Gets when this user joined this guild. </summary>


+ 3
- 2
src/Discord.Net.Core/Entities/Users/IPresence.cs View File

@@ -1,5 +1,6 @@
namespace Discord
namespace Discord
{
/// <summary> Represents a Discord user's presence status. </summary>
public interface IPresence
{
/// <summary> Gets the activity this user is currently doing. </summary>
@@ -7,4 +8,4 @@
/// <summary> Gets the current status of this user. </summary>
UserStatus Status { get; }
}
}
}

+ 2
- 1
src/Discord.Net.Core/Entities/Users/ISelfUser.cs View File

@@ -3,6 +3,7 @@ using System.Threading.Tasks;

namespace Discord
{
/// <summary> Represents a logged-in Discord user. </summary>
public interface ISelfUser : IUser
{
/// <summary> Gets the email associated with this user. </summary>
@@ -14,4 +15,4 @@ namespace Discord

Task ModifyAsync(Action<SelfUserProperties> func, RequestOptions options = null);
}
}
}

+ 1
- 0
src/Discord.Net.Core/Entities/Users/IUser.cs View File

@@ -2,6 +2,7 @@ using System.Threading.Tasks;

namespace Discord
{
/// <summary> Represents a Discord user. </summary>
public interface IUser : ISnowflakeEntity, IMentionable, IPresence
{
/// <summary> Gets the id of this user's avatar. </summary>


+ 2
- 1
src/Discord.Net.Core/Entities/Users/IWebhookUser.cs View File

@@ -1,5 +1,6 @@
namespace Discord
namespace Discord
{
/// <summary> Represents a Webhook Discord user. </summary>
public interface IWebhookUser : IGuildUser
{
ulong WebhookId { get; }


+ 2
- 2
src/Discord.Net.Core/Entities/Users/SelfUserProperties.cs View File

@@ -1,7 +1,7 @@
namespace Discord
namespace Discord
{
/// <summary>
/// Modify the current user with the specified arguments
/// Properties that are used to modify the <see cref="ISelfUser"/> with the specified changes.
/// </summary>
/// <example>
/// <code language="c#">


+ 8
- 1
src/Discord.Net.Core/Entities/Users/UserStatus.cs View File

@@ -1,12 +1,19 @@
namespace Discord
namespace Discord
{
/// <summary> Defines the available Discord user status. </summary>
public enum UserStatus
{
/// <summary> The user is offline. </summary>
Offline,
/// <summary> The user is online. </summary>
Online,
/// <summary> The user is idle. </summary>
Idle,
/// <summary> The user is AFK. </summary>
AFK,
/// <summary> The user is busy. </summary>
DoNotDisturb,
/// <summary> The user is invisible. </summary>
Invisible,
}
}

+ 6
- 6
src/Discord.Net.Core/Entities/Webhooks/WebhookProperties.cs View File

@@ -1,7 +1,7 @@
namespace Discord
namespace Discord
{
/// <summary>
/// Modify an <see cref="IWebhook"/> with the specified parameters.
/// Properties used to modify an <see cref="IWebhook"/> with the specified changes.
/// </summary>
/// <example>
/// <code language="c#">
@@ -16,22 +16,22 @@
public class WebhookProperties
{
/// <summary>
/// The default name of the webhook.
/// Gets or sets the default name of the webhook.
/// </summary>
public Optional<string> Name { get; set; }
/// <summary>
/// The default avatar of the webhook.
/// Gets or sets the default avatar of the webhook.
/// </summary>
public Optional<Image?> Image { get; set; }
/// <summary>
/// The channel for this webhook.
/// Gets or sets the channel for this webhook.
/// </summary>
/// <remarks>
/// This field is not used when authenticated with <see cref="TokenType.Webhook"/>.
/// </remarks>
public Optional<ITextChannel> Channel { get; set; }
/// <summary>
/// The channel id for this webhook.
/// Gets or sets the channel ID for this webhook.
/// </summary>
/// <remarks>
/// This field is not used when authenticated with <see cref="TokenType.Webhook"/>.


+ 8
- 1
src/Discord.Net.Core/Extensions/DiscordClientExtensions.cs View File

@@ -1,24 +1,31 @@
using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Discord
{
/// <summary> Extensions for <see cref="IDiscordClient"/>. </summary>
public static class DiscordClientExtensions
{
/// <summary> Gets the private channel with the provided ID. </summary>
public static async Task<IPrivateChannel> GetPrivateChannelAsync(this IDiscordClient client, ulong id)
=> await client.GetChannelAsync(id).ConfigureAwait(false) as IPrivateChannel;

/// <summary> Gets the DM channel with the provided ID. </summary>
public static async Task<IDMChannel> GetDMChannelAsync(this IDiscordClient client, ulong id)
=> await client.GetPrivateChannelAsync(id).ConfigureAwait(false) as IDMChannel;
/// <summary> Gets all available DM channels for the client. </summary>
public static async Task<IEnumerable<IDMChannel>> GetDMChannelsAsync(this IDiscordClient client)
=> (await client.GetPrivateChannelsAsync().ConfigureAwait(false)).Select(x => x as IDMChannel).Where(x => x != null);

/// <summary> Gets the group channel with the provided ID. </summary>
public static async Task<IGroupChannel> GetGroupChannelAsync(this IDiscordClient client, ulong id)
=> await client.GetPrivateChannelAsync(id).ConfigureAwait(false) as IGroupChannel;
/// <summary> Gets all available group channels for the client. </summary>
public static async Task<IEnumerable<IGroupChannel>> GetGroupChannelsAsync(this IDiscordClient client)
=> (await client.GetPrivateChannelsAsync().ConfigureAwait(false)).Select(x => x as IGroupChannel).Where(x => x != null);

/// <summary> Gets the most optimal voice region for the client. </summary>
public static async Task<IVoiceRegion> GetOptimalVoiceRegionAsync(this IDiscordClient discord)
{
var regions = await discord.GetVoiceRegionsAsync().ConfigureAwait(false);


+ 1
- 0
src/Discord.Net.Core/Extensions/EmbedBuilderExtensions.cs View File

@@ -2,6 +2,7 @@ using System;

namespace Discord
{
/// <summary> Extensions for building an embed. </summary>
public static class EmbedBuilderExtensions
{
/// <summary> Adds embed color based on the provided raw value. </summary>


+ 1
- 0
src/Discord.Net.Core/Logging/LogSeverity.cs View File

@@ -1,5 +1,6 @@
namespace Discord
{
/// <summary> Specifies the severity of the log message. </summary>
public enum LogSeverity
{
/// <summary>


+ 6
- 1
src/Discord.Net.Core/LoginState.cs View File

@@ -1,10 +1,15 @@
namespace Discord
namespace Discord
{
/// <summary> Specifies the state of the client's login status. </summary>
public enum LoginState : byte
{
/// <summary> The client is currently logged out. </summary>
LoggedOut,
/// <summary> The client is currently logging in. </summary>
LoggingIn,
/// <summary> The client is currently logged in. </summary>
LoggedIn,
/// <summary> The client is currently logging out. </summary>
LoggingOut
}
}

+ 1
- 0
src/Discord.Net.Core/TokenType.cs View File

@@ -2,6 +2,7 @@ using System;

namespace Discord
{
/// <summary> Specifies the type of token to use with the client. </summary>
public enum TokenType
{
[Obsolete("User logins are deprecated and may result in a ToS strike against your account - please see https://github.com/RogueException/Discord.Net/issues/827", error: true)]


Loading…
Cancel
Save