Commit Graph

2715 Commits

Author SHA1 Message Date
Christopher F
4205d68b5a Don't throw when receiving a presence for a user that doesn't exist (#746) 2017-08-29 16:26:31 -04:00
Christopher F
3c1e76615e Preemptive Ratelimits should be logged under Verbose 2017-08-28 17:21:19 -04:00
Christopher F
1ffcd4bfa7 Changed Guild#DefaultChannel to resolve the first accessible channel (#777)
* Changed Guild#DefaultChannel to resolve the first accessible channel

Resolves #776

This change is inline with hammerandchisel/discord-api-docs#329

RestGuild#DefaultChannelId is now obsolete and will throw a
NotSupportedException.

* RestGuild#DefaultChannelId will fall back to the guild ID

Adding an exception here would be a breaking change, so this was agreed
to fall back to the previous behavior, which would just return the guild
ID.
2017-08-28 16:49:16 -04:00
Christopher F
182f00f8ce Reworked IChannel.IsNsfw to support the new API flag (#771)
IChannel.IsNsfw will now return false when being used on any channel
that is not an ITextChannel. When being used on an ITextChannel, this
will now account for the API flag, and fall back to the channel name.

(this is gross design, thanks discord)
2017-08-28 16:45:53 -04:00
RogueException
361bfc1a90 Bumped version to 1.1.0-alpha 2017-08-28 16:07:39 -04:00
Alex Gravely
865080add9 Fix CreateGuildAsync not sending icon stream. (#768)
* Fix CreateGuildAsync not doing anything with the input stream for the guild icon.

Also fixes an issue with potential stream types that throw a NotSupportedException when checking its properties. [Apparently, they exist.](https://github.com/dotnet/corefx/blob/master/src/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpResponseStream.cs)

* Merged with old method

* Removed duplicate decl
2017-08-17 03:19:16 -03:00
Christopher F
506a6c96c9 Throw when attempting to add or remove a member's EveryoneRole (#781)
* Throw when attempting to add or remove a member's EveryoneRole

This resolves #780

* Removed braces
2017-08-17 02:59:58 -03:00
RogueException
f997089174 Try to pull DM channels from cache on CHANNEL_CREATE 2017-08-17 02:54:19 -03:00
Alex Gravely
6b5a6e7f1f Fix everyone mention. (#755)
* Update RestRole.cs

Fix everyone mention.

* Update SocketRole.cs

Fix everyone mention.

* I'm good at this, I swear.
2017-08-17 02:47:37 -03:00
Jay Malhotra
57a461c9ff NullOrEmpty -> NullOrWhiteSpace (#758)
Seeing as D.NET will warn you about an impending BadRequest if you try and send an empty field, why not make it warn about the impending BadRequest if you try and send a whitespace field?
2017-08-17 02:47:00 -03:00
Christopher F
22b969cbc7 Test the Discord.Color structure (#786)
This provides tests to ensure the following:
- Creating a Color
- Creating a Default Color
- Accessing a Color's Raw Value
- Accessing a Color's translated RGB values
2017-08-17 02:44:37 -03:00
Christopher F
95b78df9f0 URL-Encode reasons on Kick/Ban (#787)
This resolves #784
2017-08-17 02:43:00 -03:00
RogueException
dfcb4b39fb Allow duplicate RequireBotPermissionAttribute 2017-08-17 02:41:42 -03:00
Alex Gravely
c4dcb9dc17 Update client.cs (#752)
* Update client.cs

Let's not have the client be a local variable, hm?

* Update complete.cs

* Update complete.cs

* Update client.cs and complete.cs

Let's not have the client be a local variable, hm?
2017-07-16 11:33:01 -04:00
Hsu Still
b59c48b9ec Added IServiceProvider (#753) 2017-07-16 11:32:49 -04:00
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