Commit Graph

2700 Commits

Author SHA1 Message Date
Joe4evr
0bdc2455bc Add line to show subscribing to CommandService#Log (#756) 2017-07-16 11:32:31 -04:00
RogueException
0a41694f01 Update Discord.Net.nuspec 2017-07-14 15:32:24 -03:00
RogueException
710e1824bf Update LICENSE 2017-07-14 15:31:30 -03:00
Christopher F
8068a0ba0e Merge pull request #654 from ObsidianMinor/dev
Fixed RestGuildUser not updating inherited RestUser properties
2017-07-11 12:13:02 -04:00
Christopher F
263864f579 Bumped version to 1.0.2 2017-07-11 12:12:07 -04:00
RogueException
ff10f17cba Proper versioning is hard 2017-07-05 21:35:38 -03:00
RogueException
d27657d193 Removed hardcoded suffix from nuspec 2017-07-05 21:31:59 -03:00
RogueException
b35fbac017 Removed version from README 2017-07-05 21:30:25 -03:00
Pat Murphy
d89804d7c7 Fix potential nullref in embedBuilder value setter (#734)
* Fix potential nullref in embedBuilder value setter

* Null check on footer iconUrl

* Adding checks for the other URL properties

* Adding IsNullOrUri extension

* Setting StringExtensions as internal
2017-07-05 20:56:43 -03:00
Joe4evr
8cd99beb62 Unify ShardedCommandContext with SocketCommandContext (#739)
* Make ShardedCommandContext derive from SocketCommandContext

* Explicitly re-implement ICommandContext.Client
2017-07-05 20:23:46 -03:00
Finite Reality
d2afb06942 Make the "cannot be loaded" warning fire correctly (#729)
Why am I such a bad programmer? Maybe I'm just bad with git. Maybe I'm
just bad in general. Maybe I should resign from programming.
2017-07-05 20:19:09 -03:00
Joe4evr
b6dcc9e8d8 Add back the case for ParameterPreconditions (#735) 2017-07-05 20:13:49 -03:00
Finite Reality
7597cf5baa Fix CalculateScore throwing on missing parameters (#727)
* Fix CalculateScore throwing on missing parameters

* Bump to version 1.0.1
2017-07-05 20:09:38 -03:00
Christopher F
c316b29286 Bump version to 1.0.1 2017-07-02 12:33:03 -04:00
RogueException
26bc0b300d Updated version to 1.0 2017-06-29 20:00:26 -03:00
RogueException
ba18179eb8 Fixed compile error 2017-06-29 19:50:07 -03:00
RogueException
3b78817c54 Added int overload to EmbedBuilderExtensions 2017-06-29 19:45:02 -03:00
RogueException
14dfc48df3 Style cleanup 2017-06-29 19:44:32 -03:00
Finite Reality
fdd38c8d7f Add embed builder extensions (#460)
* Add embed builder extensions

People in #dotnet_discord-net suggested that this should be part of
the lib after I demonstrated it

* Move some extensions into EmbedBuilder [2]

Apparently git didn't like that previous commit

* Fix error with EmbedBuilderExtensions

A summary of issues which happened:
- Git decided to add an amend commit (I told it to quit?)
- VS Code thinks everything is an error so it wasn't helpful
- dotnet decided to think there was no error until I deleted all
  build outputs and rebuild

Sometimes I question my ability to use version control properly.
2017-06-29 19:44:08 -03:00
Finite Reality
74f6a4b392 Allow commands to return a Task<RuntimeResult> (#466)
* Allow commands to return a Task<RuntimeResult>

This allows bot developers to centralize command result logic by
using result data whether the command as successful or not.

Example usage:
```csharp
var _result = await Commands.ExecuteAsync(context, argPos);
if (_result is RuntimeResult result)
{
    await message.Channel.SendMessageAsync(result.Reason);
}
else if (!_result.IsSuccess)
{
    // Previous error handling
}
```

The RuntimeResult class can be subclassed too, for example:
```csharp
var _result = await Commands.ExecuteAsync(context, argPos);
if (_result is MySubclassedResult result)
{
    var builder = new EmbedBuilder();
    for (var pair in result.Data)
    {
        builder.AddField(pair.Key, pair.Value, true);
    }
    await message.Channel.SendMessageAsync("", embed: builder);
}
else if (_result is RuntimeResult result)
{
    await message.Channel.SendMessageAsync(result.Reason);
}
else if (!_result.IsSuccess)
{
    // Previous error handling
}
```

* Make RuntimeResult's ctor protected

* Make RuntimeResult abstract

It never really made sense to have it instantiable in the first place,
frankly.
2017-06-29 19:21:05 -03:00
Finite Reality
b96748f9c3 Allow arbitrary attributes to be added to commands (#458)
* Allow arbitrary attributes to be added to commands

I still don't approve adding type info back into commands, so
I decided to use this solution for allowing arbitrary attributes to be
added to commands.

Add attributes property to ParameterBuilder

Add Attributes properties to info types

* Why on earth git

* Add using for system so that Attribute can be used
2017-06-29 18:30:26 -03:00
RogueException
394e0aa4d1 Reorganized properties in Emoji.cs 2017-06-29 18:06:12 -03:00
Pat Murphy
224d0403db Adding Equals() overloads for reactions/emotes (#723) 2017-06-29 18:05:16 -03:00
Finite Reality
032aba9129 Update commands with C#7 features (#689)
* C#7 features in commands, CommandInfo in ModuleBase

* Update TypeReaders with C#7 features and IServiceProvider

* Add best-choice command selection to CommandService

* Normalize type reader scores correctly

* Fix logic error and rebase onto dev

* Change GetMethod for SetMethod in ReflectionUtils

Should be checking against setters, not getters

* Ensure args/params scores do not overwhelm Priority

* Remove possibility of NaNs
2017-06-29 17:43:55 -03:00
Alex Gravely
41222eafeb Add color presets. (#725)
* Add DiscordColors struct

* Moved presets to Discord.Color
2017-06-29 17:40:40 -03:00
Christopher F
7837c4862c Revert change of all Url types on IEmbed to string (#724) 2017-06-29 17:38:05 -03:00
Christopher F
1ce1c019b3 Add support for audit log reasons (#708)
* Add support for audit log reasons

* Made changes per discussion
2017-06-29 17:01:59 -03:00
Christopher F
9085e44dda Merge pull request #712 from AntiTcb/patch-1
Update events.cs, clarify enabling message caching.
2017-06-28 13:04:53 -04:00
Christopher F
3b8434cdc4 Merge pull request #715 from Joe4evr/patch-2
PreconditionGroup quick fix
2017-06-28 13:02:58 -04:00
Christopher F
daae56e37e Merge remote-tracking branch 'origin/dev' into dev 2017-06-27 08:49:53 -04:00
Christopher F
1d612f15c8 ToString on types of IEmote should return a chat formatted string 2017-06-27 08:49:46 -04:00
Christopher F
04e71129cf Merge pull request #718 from FiniteReality/issue/missing-tweet-type
Add 'tweet' embed type
2017-06-25 01:54:14 -04:00
FiniteReality
107f1b5803 Add 'tweet' embed type 2017-06-24 22:09:46 +01:00
Christopher F
a396a1cb1c Merge pull request #717 from Joe4evr/FixPropertyInjection
Fix attempting to inject into static properties
2017-06-24 06:47:30 -04:00
Joe4evr
cc390f03de Fix the off-chance that someone has a property without a getter 2017-06-24 02:56:57 +02:00
Joe4evr
34917a35de In my defense, it was 2:40 AM 2017-06-24 02:50:30 +02:00
Joe4evr
444868b22d Fix attempting to inject into static properties 2017-06-24 02:39:15 +02:00
Joe4evr
36ed2b49f0 PreconditionGroup quick fix
It didn't make much sense
2017-06-23 20:46:59 +02:00
Christopher F
ea685b4f23 Add 'article' EmbedType 2017-06-23 14:33:41 -04:00
Alex Gravely
707ec95717 Add SocketRole.Members property (#659)
* Add SocketRole.Members property

* Change Members to IEnumerable.
2017-06-23 12:01:44 -03:00
Amir Zaidi
d088d7b05c Add packetLoss argument for PCM streams, change FrameBytes to FrameSamplesPerChannel in OpusEncodeStream (#677) 2017-06-23 11:48:42 -03:00
Christopher F
256af0b269 Merge remote-tracking branch 'origin/issues/667' into dev 2017-06-23 10:42:19 -04:00
Pat Murphy
5601d00285 Add various property validation in EmbedBuilder (#711)
* Add various property validation in EmbedBuilder

* Embed URI changes

Changes property types for any URLs in Embeds to System.URI.
Adding field name/value null/empty checks.

* including property names in argumentexceptions

* Adds overall embed length check
2017-06-23 11:29:55 -03:00
Christopher F
5f04e2beba Cache outgoing presence data if disconnected (#705)
This resolves #702
2017-06-23 11:29:45 -03:00
Christopher F
fb0a056d76 Add IUser#SendMessageAsync extension (#706)
* Add IUser#SendMessageAsync extension

* Add ConfigureAwait
2017-06-23 11:29:39 -03:00
Finite Reality
cce572c600 Include names in command builder exceptions (#663) 2017-06-23 11:28:30 -03:00
Joe4evr
4a9c8168a9 Add grouping of preconditions to allow for flexible precondition logic. (#672)
* Add grouping of preconditions to allow for flexible precondition logic.

* Fix checking Module Preconditions twice (and none of the command's own)

* Fix command preconditions group 0 looping over every other precondition anyway #whoopsies

* Use custom message when a non-zero Precondition Group fails.

* Fix doc comment rendering.

* Refactor loops into local function

* Considering a new result type

* Switch to IReadOnlyCollection<T> and fix compiler errors

* Revert PreconditionResult -> IResult in return types - Change PreconditionResult to a class that PreconditionGroupResult inherits.

* Feedback on property name.

* Change grouping type int -> string

* Explicitly use an ordinal StringComparer

* Full stops on error messages

* Remove some sillyness.

* Remove unneeded using.
2017-06-23 11:28:22 -03:00
Christopher F
d44d5e7198 Merge pull request #710 from FiniteReality/issue/704
Change wording of permission preconditions
2017-06-20 21:03:33 -04:00
Alex Gravely
6e21d33999 Update events.cs
Forgot a var >_>
2017-06-20 20:44:33 -04:00
Alex Gravely
759da09c38 Update events.cs
Gladly taking suggestions for a better comments.
2017-06-19 15:21:46 -04:00