Commit Graph

2776 Commits

Author SHA1 Message Date
Christopher F
42c879c37c Add 'html' to EmbedType enum
This resolves #762.

This change adds an 'html' variant to the EmbedType enum.

This change also adds an 'Unknown' variant to the EmbedType enum (at
position -1); this will be used in a later commit to future-proof the
EmbedType enum from any further variants Discord may add.
2018-01-08 02:29:24 -05:00
Christopher F
0f2af47ec8 Fix typo in API model for GameAssets
This would cause the large asset's Image ID (and in turn, Image URL) and
hover text to be reversed.
2018-01-07 15:55:01 -05:00
Christopher F
9d77a3cd37 Fix parsing timestamps with a timezone attached
Resolves #918.

For some reason (that i'm sure will bite me in the ass later), we
configured Json.Net with a time format that forced UTC - even when the
API appends a timezone to the timestamp. Removing the custom time format
seems to resolve this issue.
2018-01-06 23:36:08 -05:00
Christopher F
fdd2c80d2b Fix outgoing activity sending (#916)
This change resolves #916

Discord requires the {"type": 0} payload for all non-streaming
activities. This change fixes a bug where name-only games would fail to
include this payload, causing the presence change to be discarded by
Discord.
2018-01-06 23:20:21 -05:00
Christopher F
d5e9d6f9c1 Fix ShardedClient#GetShardFor null-case (#742)
This resolves #742.

Common cases for IGuild being null on access are DMs (since they do not
belong to a guild) - this change resolves null guilds to shard zero,
where DMs are also received.
2018-01-06 22:56:54 -05:00
ObsidianMinor
5bbd9bba82 Renamed existing Flatten method to FlattenAsync and added new Flatten method. Also fixed ClientHelper using incorrect guild batch count. (#744) 2018-01-06 22:43:11 -05:00
Chris Johnston
edfbd055bb Fix #854 Added ViewChannel enum and property to channel permissions (#874)
* Fix #854 Added ViewChannel enum and property to channel permissions

* replaced usages of ChannelPermission#ReadMessages with ViewChannel

* rename parameter of ChannelPermissions constructor

* made OverwritePermissions#ReadMessages obsolete, use ViewChannel instead

* Fix #854 Added ViewChannel enum and property to channel permissions

replaced usages of ChannelPermission#ReadMessages with ViewChannel

rename parameter of ChannelPermissions constructor

made OverwritePermissions#ReadMessages obsolete, use ViewChannel instead

* renamed readMessages parameter in ChannelPermissions constructor and Modify

* fixed channel permission tests to use ChannelPermission enum instead of GuildPermission enum

* replaced usages of readmessages in channel permission tests

* resolve build warnings for permission tests
2018-01-06 22:35:17 -05:00
BinkanSalaryman
804d9188e7 Fix flawed bulk message deletion (#872)
* Fix flawed bulk message deletion

https://github.com/RogueException/Discord.Net/issues/871, consider changing DeleteMessagesParams.MessageIds type to I(Readonly)List<ulong> or IEnumerable<ulong> to avoid unnecessary copying (batch.ToArray())

* Update code formatting
2018-01-06 22:33:00 -05:00
Christopher F
cd82a0f70c Added a contributing guide (#828)
commit 779ec4677e8b3979f83bcc6a673062ff6caa8be6
Author: Christopher F <computerizedtaco@gmail.com>
Date:   Wed Sep 27 21:14:54 2017 -0400

    Added a contributing guide

    Happy Hacktoberfest 🎃
2018-01-06 22:30:52 -05:00
Christopher F
5c8c78498b Add EditorConfig (#876)
commit c692306fcc1e86ab92dd10683d3719f16c02a249
Author: Acid Chicken (硫酸鶏) <root@acid-chicken.com>
Date:   Sat Nov 11 10:49:00 2017 +0900

    Add target of the internal fields

commit 2d08f9a655b4949c1177f778d0f499047484a537
Author: Acid Chicken (硫酸鶏) <root@acid-chicken.com>
Date:   Sat Nov 11 10:17:42 2017 +0900

    Add some more extension

commit 4f19b835ffe8c64a93a9b4659e60b03ac797760f
Author: Acid Chicken (硫酸鶏) <root@acid-chicken.com>
Date:   Sat Nov 11 01:19:11 2017 +0900

    Add naming rules

commit af756cd9feb630baadbf6025cbb079cd9e1f45cb
Author: Acid Chicken (硫酸鶏) <root@acid-chicken.com>
Date:   Sat Nov 11 00:35:30 2017 +0900

    Add basic .NET style rules

commit 503ece558b4f07bd8008157d3aeb6a4e7100d349
Author: Acid Chicken (硫酸鶏) <root@acid-chicken.com>
Date:   Fri Nov 10 22:36:52 2017 +0900

    Add EditorConfig
2018-01-06 22:30:04 -05:00
Christopher F
030422fa1d Add support for channel categories (#907)
commit a85c5814a74e473e95fe172f0379cbc7f9f951d8
Author: Christopher F <computerizedtaco@gmail.com>
Date:   Sat Jan 6 22:25:48 2018 -0500

    Code cleanup

commit 4b243fd3dd99152b4ebc7ee01d704bd8e57eeee1
Author: Christopher F <computerizedtaco@gmail.com>
Date:   Sat Jan 6 22:08:28 2018 -0500

    Add support for channel categories (#907)

    commit 41ed9106f2b05530acbf06b245c9aa618011d815
    Author: mrspits4ever <spits.lucas@gmail.com>
    Date:   Thu Dec 14 20:02:57 2017 +0100

        removed mentioning support for RestCategoryChannel, added channels property to SocketCategoryChannel

    commit 71142c310847886dff80c49e9357dd0786d67a1b
    Merge: 4589d731 678a7238
    Author: mrspits4ever <spits.lucas@gmail.com>
    Date:   Wed Dec 13 21:17:53 2017 +0100

        Merge branch 'dev' of https://github.com/RogueException/Discord.Net into feature/channel-categories

    commit 4589d73187871c98485ed25c6d223706927af7ec
    Author: mrspits4ever <spits.lucas@gmail.com>
    Date:   Wed Dec 13 21:17:46 2017 +0100

        adressed requested changes

    commit d59b038efa048b2279602e2015ddd2c185e58d63
    Author: pegasy <pegasy@users.noreply.github.com>
    Date:   Mon Sep 25 18:53:23 2017 +0200

        Renamed classes / properties / methods to use CategoryChannel instead of ChannelCategory to be consistant with how text / voice channels are named.

    commit 5c4777dc8cc443108f2e7e4afae98824c9a32b1f
    Author: pegasy <pegasy@users.noreply.github.com>
    Date:   Sun Sep 24 19:08:25 2017 +0200

        removed Guild from class name for ChannelCategory
        Renamed all properties to use Category instead of Parent
        Throw exception on GetUsers / GetInvites etc for categories

    commit e18bd8c799d2327270021c05866cb2e97ad4671b
    Author: pegasy <pegasy@users.noreply.github.com>
    Date:   Sun Sep 24 15:49:51 2017 +0200

        Add support for channel categories (as its own channel type)
2018-01-06 22:27:51 -05:00
Still Hsu
39bddca5d1 Fix broken markdown in command docs (#920)
I screwed up in ##826 and broke the `CommandAttribute` section.
2018-01-05 21:04:07 -05:00
Christopher F
c08f37bb03 Fix nullref exceptions from Rich Presences 2018-01-05 20:49:59 -05:00
Chris Johnston
227f61aa4e Allow null value to reset IGuildUser nickname (#923)
* Added workaround for UserHelper#ModifyAsync that accepts null values as a way to reset user nicknames

* Update comments

* Update comment to use see tag
2018-01-05 20:24:21 -05:00
Christopher F
b30af57b7f Remove RPC from main distribution (#925) 2018-01-05 20:23:19 -05:00
vim2meta
5f46aef3a7 Ability to ignore unused parameters instead of failing the command. (#915)
* Addition of FailOnTooManyArgs

* Correct name & only pass in bool
2018-01-05 15:02:27 -05:00
Christopher F
5ce85deb9d Attempt to patch the GameParty nullref
Not sure if this works, needs a more proper solution in the future
anyways
2017-12-27 14:47:55 -05:00
Alex Gravely
7b2ddd027c Add missing REST Webhook implemenation (#843)
* Add Webhook API models, REST implementation, and Socket bridges.

* Remove token overrides from REST.

Leaving that as a Webhook package only feature.

* Add Webhook API models, REST implementation, and Socket bridges.

* Remove token overrides from REST.

Leaving that as a Webhook package only feature.

* Webhook core implementation.

* Webhook REST implementation.

* Webhook client implementation.

* Add channel bucket id.
2017-12-23 15:17:20 -05:00
Christopher F
a19ff188e9 Added support for animated emoji (#913)
* Added support for animated emoji

This was such a useful feature Discord, I'm glad you added this instead
of fixing bugs.

* Fix bugs in emote parser

* Added unit tests for emotes
2017-12-23 15:09:24 -05:00
Christopher F
34b4e5a6d2 Refactor Games, support reading Rich Presences (#877)
* Add API-level support for Rich Presences

* Add library-level support for Game presences

* Add model conversions for outgoing+incoming rich presences

* Refactored Game into Activities

* Integrated Activities with user entities

rebase hell from 5f3cb947a92f4fd01cc4df47ca548180036b47f3

* Fix JSON converters for Activities

* Finish rebase, activity should be set on BaseSocketClient

* Use ApplicationId to define a rich presence

* Added SetActivityAsync to Base and Sharded Socket clients

* Remove public parameterless Game constructor

* Remove GameAssets, refactored to GameAsset

* Hide constructors for types that should be read-only

* Revert changes to Discord.Net.sln

got damned visual studio caching

* Refactor GameParty to use dedicated current/capacity values

Per feedback from @khionu
2017-12-23 14:58:35 -05:00
Christopher F
678a7238e6 Allow users to opt-in to proxies (#888)
* Allow users to opt-in to proxies

* Allow opting in to proxies on the WebSocket
2017-12-07 16:47:01 -05:00
Christopher F
39b5d0e74c Bumped version to 2.0.0-beta 2017-11-22 20:13:10 -05:00
Christopher F
bbad052ec7 Update invite link
thank you @SinisterRectus :slight_smile:
2017-11-22 20:09:07 -05:00
Christopher F
c461201fa5 Fix async warnings 2017-11-22 19:39:26 -05:00
Christopher F
e5dfb6c3e5 Fix null channel being passed in RequirePermission preconditions (#886)
* Fix null channel being passed in RequirePermission preconditions

* c#7 pattern matching
2017-11-21 16:33:46 -05:00
Mateusz Brawański
b4bf046ad4 Implemented emoji endpoints (#835)
* Implemented emoji endpoints.

* Fixed: now using API entities for REST client.

* Removed emoji listing endpoint, as per @foxbot's request.
2017-11-20 15:02:42 -05:00
Chris Johnston
cf8de42b62 Add GuildPermissions and ChannelPermissions Unit Tests (#873)
* initial commit

* Add GuildPermission tests for constructor and modify parameters

* Fixed GuildPermission All value. Previous value had an additional digit that would still resolve to correct permission flags, but raw value would be incorrect. This matches the result of the sum of all GuildPermission flags

* Added raw value check to guild permission modify tests

* Add ChannelPermissions tests
2017-11-20 14:54:10 -05:00
Christopher F
9979a027d5 Change default InviteAge to 24 hours
Resolves #859
2017-11-10 15:39:33 -05:00
Christopher F
8d533930fa Move CommandExecuted invoking up a scope for generic Task commands
Resovles #870
2017-11-10 15:26:58 -05:00
Christopher F
623d60fe51 Merge remote-tracking branch 'origin/dev' into dev 2017-11-06 20:41:08 -05:00
Christopher F
676be4081b Ignore messages with an ID of 0 when calculating age 2017-11-06 20:40:59 -05:00
Chris Johnston
dec7cb2b5b Fix GuildPermission Modify, Add Missing Permission to AllowAll (#866)
* Use named parameters in GuildPermission constructor, fix ordering of parmeters in Modify constructor call

* fix missing constructor parameter

* Added missing Webhook permission for the all text permissions value

* Resolves #869 Add UseExternalEmojis permission to GuildPermissions.All
2017-11-05 22:06:41 -05:00
Joe4evr
e30fd29085 Tweaks to audio docs (#867)
* Tweaks to audio docs

* Make it more obvious that -1 means infinity
2017-11-05 22:06:28 -05:00
enzosk8
da335b95c4 Fix general typos (#852) 2017-11-05 22:05:19 -05:00
Alex Gravely
dc151e8998 Update VS Code csproj example to target version 1.0.2. (#849)
* Update target version to 1.0.2.

* Change to target latest 1.x stable.
2017-11-05 22:05:09 -05:00
Alex Gravely
5218e6be97 Add IEmbed#ToEmbedBuilder extension method (#863)
* Add IEmbed#ToEmbedBuilder extension method

* Implementing reviewed changes.

* Switch to object initializers for author and footer.
2017-11-05 21:57:24 -05:00
Chris Johnston
f9963380a7 Proposed Solution for #674 Permissions Changes (#743)
* Initial commit of changes. Changed permissions from bitwise index to use bitwise flags instead. Modified relevant methods involved

* Revised enum value naming

* Added FlagsAttribute to ChannelPermission, GuildPermission

* Added comments per Joe4evr suggestion

* Added underlines to hex value digits for readability per Joe4evr suggestion

* updated names to better reflect actual permission names as per SubZero0 suggestion

* fix for 236775c2d8aca9481d6c51c674f5727f97adec04

* Replaced Math.Pow with left shift operator

* Cleaned up the formatting of ChannelPermission and GuildPermission enums to make it easier to read
2017-10-25 20:39:26 -04:00
Finite Reality
759db34146 Remove payload compression, use stream compression (#853) 2017-10-21 13:51:20 -04:00
Christopher F
14fbe40cbc Add Async suffix to command-related Tasks (#804)
commit b7fb44a94fb1e75f696f281d6b201eba3f48e864
Author: Hsu Still <341464@gmail.com>
Date:   Sat Sep 2 14:34:18 2017 +0800

    Fix more async naming violation

commit e6912e2d020c69325826dbfa62c07cd1ef2cc45f
Author: Hsu Still <341464@gmail.com>
Date:   Sat Sep 2 14:23:04 2017 +0800

    Fix incorrect null xmldocs string

commit da8d23222d207853375c3512232d1d7fd3629cad
Author: Hsu Still <341464@gmail.com>
Date:   Sat Sep 2 14:17:12 2017 +0800

    Fix CheckPreconditionsAsync

commit 992407407a42fec9087c9ed18e0bf5de30dff82c
Author: Hsu Still <341464@gmail.com>
Date:   Sat Sep 2 14:07:12 2017 +0800

    Add Async suffix to abstract Task methods
2017-10-09 19:45:12 -04:00
Alan Schapira
d8c4b7537b Client is global variable (#789)
In the previous section of the tutorial https://github.com/RogueException/Discord.Net/blob/dev/docs/guides/getting_started/samples/intro/client.cs, the client it a global variable with an underscore
2017-10-03 20:09:06 -04:00
Joe4evr
88c9964b54 Minor Quickstart tweaks (#783)
* Remove saving Console.ForegroundColor to a local

* Add message handler checks

* Add comment explaining that there's two differently named methods to add modules

* Add comment about the Commands package

* Add Exception property to log handler
2017-10-03 20:07:54 -04:00
Vollrat
71e8b88514 Improve upon Property Summaries in CommandServiceConfig (#839)
* Improve Boolean Property Summaries

Having the `CaseSensitiveCommands` property summary asking a question whenever Intellisense is invoked seems a bit nonessential instead of *properly* explaining what exactly it does. It would be better if instead, it stated it's use to be more comprehensible to the reader.

### Changes

- Edits the summaries of `CaseSensitiveCommands` and `ThrowOnError` to follow a more methodical convention for boolean property summaries (`Determines whether X ...` rather than `Should X be ... ?`).

This is just a small change to improve upon the current documentation, so it shouldn't conflict with anything.

* "DefaultRunMode should also be "Gets or sets blah blah blah" to be consistent."
2017-10-03 20:04:38 -04:00
Hsu Still
22d79c1004 Improve library documentation (#826)
* Improve the Command Service documentation

The following changes have been added to this PR:
•	Fix minor grammatical errors.
•	Capitalize terms such as Commands, Modules and such, as the context is specific to the lib.
•	Wrap methods and properties in code blocks.

The docs page currently has several issues that remains to be fixed.

1. 
```md
>[!WARNING]
>This article is out of date and has not been rewritten yet.
Information is not guaranteed to be accurate.
```

The docs doesn't necessarily seem "out of date" as the warning claims. The basics seem pretty relevant to the latest version of the lib.

2.
>“To manually load a module, invoke [CommandService.AddModuleAsync], by passing in the generic type of your module and optionally, a dependency map.”

The latter part of the sentence seems off. Where should the user pass the dependency map to? It seems to suggest that `AddModuleAsync` has an argument to pass the dependency to. If it is referring to `AddModuleAsync(Type type)`, then I feel like it should be clarified here - or perhaps change the wording of the sentence.

3.
>“First, you need to create an @System.IServiceProvider You may create your own IServiceProvider if you wish.” 

Any mention of @System.IServiceProvider is currently broken on the docs.

4.
>“Submodules are Modules that reside within another one. Typically, submodules are used to create nested groups (although not required to create nested groups).”

Clarification on the part after "although?"

5.
>“Finally, pass the map into the LoadAssembly method. Your modules will automatically be loaded with this dependency map.”

Where is this `LoadAssembly` method?

6.
```md
>[!NOTE]
>Preconditions can be applied to Modules, Groups, or Commands.
```

The docs should mention `ParameterPreconditionAttribute`'s existence.

* Update line breaks to comply with docs standard

* Change "you should..." to "instead, ..."

* Trim trailing spaces

* Change "inherits" to "inherit"

* Fix Context warning note and add ReplyAsync xref

* Fix broken xrefs

* Fix [Command Service] xref

* Fix consistency between TypeReaders and Preconditions returns

* Add missing semi-colons in ServiceProvider sample

* Change CommandContext to SocketCommandContext & change variable naming

* Cleanup TypeReader section

* Wrap [DontInject] in code block

* Fix commands docs linking in intro

* Improve Getting Started - Installation

- Fix character misalignment to comply with docs standard.
- Fix image numbering issues by moving the tooltips above some of the steps.
- Add codeblocks to search terms like `Discord.Net`.
- Remove broken `addons` reference.
- Specify `.NET 4.6.1` as `.NET Framework 4.6.1`.
- Minor cross-reference cleanup.

* Fix Getting Started - Intro

- Minor grammartical fixes.
- Wrap mentions of the methods, properties, and events in code block.
- Replace `Discord.Net` to `Discord.NET`.
- Fix steps numbering under `Creating a Discord Bot` and `Adding your bot to a server`.
- Change `Task-based Asynchronous Pattern ([TAP])` linking to mark the entire term instead.
- Change code block of `Pong!` to quotation mark instead.

* Fix cross references in Sending Voice

* Mention parameter precondition attribute

* Change `Discord.NET` to `Discord.Net` for consistency

* Wrap project names in code blocks & minor fixes in Terminology

* Change `add-ons` to `addons` for consistency

* Fix cross references in Logging

* Fix minor grammatical issues in "Working with Events"

* Missed a tilda

* Remove out-of-date warning in Commands

* Minor grammatical fixes for Entities

* Fix broken xref in Logging

* Adjust service collection sample

...according to f89aecb7bf (r141530227)

* Update Command Handler sample

- Update Main for C# 7.1.
- Inject CommandService and DiscordSocketClient into the service collection.
- Add Async suffix to asynchronous methods.

* Minor grammatical fixes in Events

* Revert 2 incorrect grammar corrections

* Revert async Main sample

* Add hardcode token notice in sample

* Fix missing method for Command Handler

* Modify module samples to use SocketCommandContext instead

* Emphasize CommandContext and SocketCommandContext

* Fix formatting for module sample

* Add SocketCommandContext for Groups sample

* Remove comma

* Fix DepMap sample formatting

* Replace [DontInject] with DontInjectAttribute with cross reference

* Remove connection logic note

There is no reason that this note should still be here since Ready event exists.

* Add a new warning message informing the users the existence of CommandService

* Make command handler private

excellent change
2017-10-03 16:48:05 -04:00
Alex Gravely
e00f17fe55 Move DeleteMessagesAsync from IMessageChannel to ITextChannel (#829) 2017-10-01 15:37:13 -04:00
Christopher F
347c5a0d39 Disable obsolete warnings in files that reference TokenType.User 2017-09-29 17:37:07 -04:00
Chris Johnston
f8108871d6 Typo fix for SocketGuildUser.Hierarchy description (#831) 2017-09-28 16:26:23 -04:00
Alex Gravely
9b7afec4cc Add BaseSocketClient object. (#773)
* Add BaseDiscordClient. Add various missing RequestOptions args.

DiscordSocketClient and DiscordShardedClient's shared members now exist in this abstract class.

* Add ShardReady event.

* Style consistency. Remove extraneous overloads.

Remove extraneous overloads.

* Add BaseSocketClient#DownloadUsersAsync().

Style cleanups.

* Add ShardLatencyUpdated event.

Style cleanup.

* Hook LatencyUpdated for ShardedClient.

* Begone whitespace.

* I'm good at this, I swear. >_>

* Add back DiscordShardedClient.UserPresenceUpdated

* Add ObsoleteAttribute

* Removing the UserPresenceUpdated event.
2017-09-27 18:20:31 -04:00
Christopher F
fc5adca94e Obsolete TokenType.User 2017-09-27 18:17:48 -04:00
Chris Johnston
30e867a183 Implement welcome message channels (#819) 2017-09-23 17:00:08 -04:00
Joe4evr
e25054bb3b Update WS4Net dependency to 0.15.0 (#812)
Also changes target to NetStandard1.3
2017-09-10 23:14:45 -04:00