You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

CommandInfo.cs 15 kB

Squashed commit of the following: commit 17a4af71ee8062966bfe477d4d9ea68b490cfb77 Author: Still Hsu <341464@gmail.com> Date: Tue May 29 17:15:10 2018 +0800 Add documentation for new API version & few events commit f4fb027ea9cab9ba990a55676d8453bea3e68b1a Merge: d74c5287 3acf2a9a Author: Still Hsu <341464@gmail.com> Date: Tue May 29 08:25:41 2018 +0800 Merge remote-tracking branch 'upstream/dev' into docs/faq-n-patches-offline commit 3acf2a9a6bb13d5b75c09babaf7234cb2707f4e8 Author: HelpfulStranger999 <helpfulstranger999@gmail.com> Date: Mon May 28 14:59:30 2018 -0500 Refactors readMessages, fixing from #1033 (#1075) commit 513a489bf82ed4e845ff3df9fe21c06e80bb28b8 Author: Christopher F <foxbot@protonmail.com> Date: Mon May 28 15:45:42 2018 -0400 codefix: add VoiceAPIVersion constant to DiscordConfig commit 9ba38d77966897037cb6355eda2215fd9a235712 Author: Christopher F <foxbot@protonmail.com> Date: Mon May 28 15:35:59 2018 -0400 api: upgrade audio client to VoiceWS v3 commit 64d8938ed5100d4c8f3a2afaec3a6becb53cf9b8 Author: Christopher F <foxbot@protonmail.com> Date: Mon May 28 15:25:46 2018 -0400 fix: Discord does not always send the member on VOICE_STATE_UPDATE some guilds aren't on g250k yet? not sure commit aeb30955932803e88fcd056f817f449e8664715f Author: FiniteReality <digpoealternate@gmail.com> Date: Mon May 28 17:48:38 2018 +0100 Remove Debug.Print call causing tests to fail Forgot to hit save properly... Whoops. commit a718a7d3c234a37d1c792ac84af0ae8dce61c1a5 Author: Christopher F <foxbot@protonmail.com> Date: Mon May 28 12:45:49 2018 -0400 cleanup: Remove ChannelHelper#IsNsfw Closes #1074 This code was not referenced anywhere in the active codebase. commit 0c7cb73b06aba3eaeb811b4671fd0f4a5078a491 Author: FiniteReality <digpoealternate@gmail.com> Date: Mon May 28 17:41:05 2018 +0100 Fix permission-related ViewChannel tests commit 415e2f773978353025ea8b2f6c3d9929601c28c1 Author: FiniteReality <digpoealternate@gmail.com> Date: Mon May 28 17:14:18 2018 +0100 Fix analyzer warnings with tests Use (actual, expected) format for Assert.Equal, fixes analyzer warnings commit b0042606b628e02ffe2bee3135c7ed42c3b8311f Author: FiniteReality <digpoealternate@gmail.com> Date: Mon May 28 17:13:59 2018 +0100 Move RpcCategoryChannel into the correct project commit 683b3f2701087db6d49c3a54c6d99c80ef5b2e5a Author: FiniteReality <digpoealternate@gmail.com> Date: Mon May 28 17:12:28 2018 +0100 Mark ChannelHelper.IsNsfw Obsolete Discord no longer treats channels prefixed with 'nsfw' as NSFW, so we no longer need to have this check. commit d74c52873fb13434bca9dd8b56e74104392cb95d Merge: 341b9588 237ad0f8 Author: Still Hsu <341464@gmail.com> Date: Mon May 28 11:48:47 2018 +0800 Merge branch 'dev' into docs/faq-n-patches-offline commit 237ad0f8675023478ec8ad41c7b6b6fd19ceed2d Author: Christopher F <foxbot@protonmail.com> Date: Sun May 27 18:00:51 2018 -0400 Revert "fix: Properly rethrow exceptions in SocketGuild audio client" This reverts commit adf4da19fc116759c4246c978143987712fa2116. Someone hasn't written c# in a while commit adf4da19fc116759c4246c978143987712fa2116 Author: Christopher F <foxbot@protonmail.com> Date: Sun May 27 17:56:14 2018 -0400 fix: Properly rethrow exceptions in SocketGuild audio client commit c0c565fd7ee03fa569027fff7f17db90d9376b4f Author: Christopher F <foxbot@protonmail.com> Date: Sun May 27 16:45:54 2018 -0400 retain fallback case for if user is still null commit 8fb2c71814fad9bcab1888fb8d66d693cc98a4b1 Author: Christopher F <foxbot@protonmail.com> Date: Sun May 27 16:37:17 2018 -0400 Add new member objects to events commit 341b9588d608bcd7460e751b7b0d2cd83bc42e32 Author: Still Hsu <341464@gmail.com> Date: Sun May 27 19:01:04 2018 +0800 Add documentation commit 2df635e025ef7de2959c232e468f093c103f250f Merge: 180b20dd 9995cab4 Author: Still Hsu <341464@gmail.com> Date: Sun May 27 18:25:51 2018 +0800 Merge pull request #1 from Chris-Johnston/better-documentation-for-quotation-mark-aliases Improve XML docs for commands quotation mark aliases feature commit 180b20dd02edddfe1d279348516f5d54985eb8f0 Author: Still Hsu <341464@gmail.com> Date: Sun May 27 18:19:20 2018 +0800 Add documentation for new INestedChannel commit e9f72b6ece60ffe142266b01f90bd5ae8b00c742 Author: Still Hsu <341464@gmail.com> Date: Sun May 27 18:18:52 2018 +0800 Fix missing service provider in example commit 9995cab40ce542562d87183cff91707bd6f07e60 Merge: a8d3031b 1a146afb Author: Chris Johnston <chris@thejohnstons.net> Date: Sun May 27 01:11:17 2018 -0700 Merge branch 'docs/faq-n-patches-offline' into better-documentation-for-quotation-mark-aliases commit a8d3031b2d73bbe813e83bb439345975d1003b55 Author: Chris Johnston <chris@thejohnstons.net> Date: Sat May 26 23:32:40 2018 -0700 Add explanation that if " is removed then it wont work commit cb7c6d35464bd2d8aa0d5cc0dd20c8a6fa11bb4f Author: Chris Johnston <chris@thejohnstons.net> Date: Sat May 26 23:29:32 2018 -0700 Add reference to CommandServiceConfig from the util docs' commit 110b97513fbd26695674190ab217800490e27185 Author: Chris Johnston <chris@thejohnstons.net> Date: Sat May 26 23:15:01 2018 -0700 Add more XML comments to quotation mark alias map stuff, including an example commit 1a146afbe1f539c210648c39985009bd4ad926b3 Merge: cb57ada8 a06e2126 Author: Still Hsu <341464@gmail.com> Date: Sun May 27 11:25:10 2018 +0800 Merge branch 'dev' into docs/faq-n-patches-offline commit a06e21261c66e7aeacde11911ce5ee1ed6baba2f Author: Chris Johnston <chris@thejohnstons.net> Date: Sat May 26 11:15:09 2018 -0700 Fix ChannelPermissions Modify parameter to be correct default value (#1003) * fix channel permissions modify parameter to use nullable boolean, correct default value * Add general tests for the ChannelPermissions.Modify method to test default values * remove unused cast in tests * add guildpermission modify no param tests * Add no-param modify tests for OverwritePermissions * fix inconsistent parameters in GuildPermissions cstr * Adjust formatting of methods and cstrs with many parameters * remove temp file that was included. no idea what that is * Fix System dependency I should really stop fixing merge conflicts in the github website. commit f9cbff5e42c04aa8a0fe87377ba68aa7d748d873 Author: Chris Johnston <chris@thejohnstons.net> Date: Sat May 26 11:06:35 2018 -0700 Fix #995, Move Category Implementation from IGuildChannel to INestedChannel (#1004) * Fix #995 ICategoryChannel.CategoryID throws NotSupportedException * Add tests * change run mode of TestChannelCategories * Add throw for GetCategoryAsync * Add xml doc explaining why exception is thrown * Add test coverage for text and voice channel categories * initial implementation of INestedChannel * more implementation of INestedChannel design * Add case in RestChannel Create for Category type * set the CategoryID for RestVoiceChannel * rewrite channel category tests to work with existing pattern * remove outdated todo * Make IVoiceChannel implement INestedChannel * remove redundant interface implementation * Add c#7 feature from feedback * Remove redundant GetCategoryAsync methods from socket entities * Added configureawait to async methods * change signature of interface GetCategoryAsync * Add check for cachemode in rest channel GetCategory * remove redundant IGuildChannel interface from ITextChannel and IVoiceChannel commit 4d8764e124cef12af4b0944d185ec22d9683c520 Author: FiniteReality <digpoealternate@gmail.com> Date: Sat May 26 14:11:49 2018 +0100 Refactor RoleInfo types into separate classes - Fixes indentation with a few files (looks like a bad copy+paste job) - Renames RoleInfo to RoleEditInfo - Moves RoleInfo from MemberRoleAuditLogData into its own class All of this should improve docs. commit cb57ada8d9f4a8a8b787ba6990afb08ea81a89a1 Author: Still Hsu <341464@gmail.com> Date: Sat May 26 21:03:07 2018 +0800 Add partial documentation for audit log objects commit afda0cd172a98154bc33b4c27eed65580189785d Author: Still Hsu <341464@gmail.com> Date: Sat May 26 20:47:21 2018 +0800 Add documentation for some REST-based objects commit 098ead93d98ea9e629f9c4d8681a38ad8c1e9a82 Author: Still Hsu <341464@gmail.com> Date: Sat May 26 16:33:38 2018 +0800 Add partial documentation for audit log impl commit 5d1621a9c5ea27d8758e6a6e6dc4b4d6c093ff7a Author: Still Hsu <341464@gmail.com> Date: Sat May 26 16:06:20 2018 +0800 Fix xml docs error commit 596b47e1b8bbdd349df20da7938eaf4581bccb91 Merge: 3f572ccc fa759a22 Author: Still Hsu <341464@gmail.com> Date: Sat May 26 15:54:08 2018 +0800 Merge branch 'dev' into docs/faq-n-patches-offline commit 3f572ccc0d10fbdcc514f5ef0701b06c8b75e7ec Merge: 73ebc025 a9983026 Author: Still Hsu <341464@gmail.com> Date: Sat May 26 15:32:38 2018 +0800 Merge branch 'docs/faq-n-patches-offline' of https://github.com/Still34/Discord.Net into docs/faq-n-patches-offline commit 73ebc0258031ff74770b1f4b4a8c4be9071f703c Author: Still Hsu <341464@gmail.com> Date: Sat May 26 15:32:23 2018 +0800 Fix light theme link color commit fa759a22eac25183eb0fecf6cd0fbbf7f476fa11 Author: Chris Johnston <chris@thejohnstons.net> Date: Fri May 25 06:38:59 2018 -0700 Remove Build Warnings for Obsolete Guild Permission Read Messages (#1067) - Replaces the usages of `ReadMessages` with `ViewChannel` - Renames the read message parameters of `GuildPermissions#Modify` to be view channel as well commit bbbac85c46162d7bb44ecdd68194ab79db25037d Author: Hawx <Hawxy@users.noreply.github.com> Date: Fri May 25 20:14:28 2018 +0800 Update Dependencies and support NS2.0 builds (#1046) * Update deps, fix test warnings. * Support ns2.0 * Fix typo * Remove ns1.1 support * Net.Http and Net.Websockets.Client are not needed in ns2.0 * Move to net46 per volt * Remove ns1.3 constants commit 5f084adf94f3215b6d68c3a8b61cbfad7376f18c Author: HelpfulStranger999 <helpfulstranger999@gmail.com> Date: Thu May 24 19:17:19 2018 -0500 Deprecates ReadMessages, introduces ViewChannel (#1033) * Deprecates ReadMessages, introduces ViewChannel * Adds period and comma somehow missed commit bc6009ec7207e16aedecdc658dc59b8ac02c400e Author: Still Hsu <341464@gmail.com> Date: Fri May 25 08:08:51 2018 +0800 Implement IMessageChannel#DeleteMessageAsync (#996) * Implement DeleteMessageAsync * Refer to MessageHelper instead of duplicating call * Fix refactor error commit cee71ef35a450802ef35090d9eaf167ca39306e8 Author: Chris Johnston <chris@thejohnstons.net> Date: Thu May 24 17:07:37 2018 -0700 Add support for parsing multiple types of quotation marks in commands, Fix #942 (#943) * Add ability to support different types of quotation marks * Added normal quotation mark to list of aliases, removed single quote mark * clean up leftover changes from testing * change quotation mark parsing to use a map of matching pairs * remove commented out code * Fix conventions of the command parser utility functions * change storage type of alias dictionary to be IReadOnlyDictionary * revert type of CommandServiceConfig QuotationMarkAliasMap to Dictionary * minor formatting changes to CommandParser * remove unnecessary whitespace * Move aliases outside of CommandInfo class * copy IReadOnlyDictionary to ImmutableDictionary * minor syntax changes in CommandServiceConfig * add newline before namespace for consistency * newline formatting tweak * simplification of GetMatch method for CommandParser * add more quote unicode punctuation pairs * add check for null value when building ImmutableDictionary * Move default alias map into a separate source file * Ensure that the collection passed into command service is not null commit b52af7ae7caaddd79101aeb9f5af2ce482890bc2 Author: Joe4evr <jii.geugten@gmail.com> Date: Fri May 25 01:59:32 2018 +0200 Add a dedicated TimeSpan reader so it doesn't suck (#1005) * Add a dedicated TimeSpan reader so it doesn't suck * Pass input as lower case commit c275e575289073fe42ead725de97b97301c7dc50 Author: o Acid Chicken (硫硫▒~E▒▒▒~O) <root@acid-chicken.com> Date: Thu May 24 19:52:25 2018 -0400 Add support casting System.Drawing.Color to Discord.Color commit fa3303426766a59e7aa4d67e8b50826cfe7204ec Author: Acid Chicken (硫酸鶏) <root@acid-chicken.com> Date: Sun Apr 29 13:50:56 2018 +0900 Use built-in symbol refs: https://github.com/RogueException/Discord.Net/pull/1043#issuecomment-385223999 commit 27ea82668587960925b73f97c924c9d39ee71f7b Author: Acid Chicken (硫酸鶏) <root@acid-chicken.com> Date: Sun Apr 29 11:29:31 2018 +0900 Add support casting System.Drawing.Color to Discord.Color commit 1ab9de24978ff24a018767f80dc95ba19b616988 Merge: f5bb99c7 a4d1e2bc Author: Acid Chicken (硫酸鶏) <root@acid-chicken.com> Date: Sun Apr 29 10:16:46 2018 +0900 Merge remote-tracking branch 'upstream/dev' into dev commit f5bb99c77d0fecec21ad769778d17144c047d8b1 Merge: 3be8e40d b8b59d97 Author: Acid Chicken (硫酸鶏) <root@acid-chicken.com> Date: Tue Apr 10 11:07:36 2018 +0900 Merge remote-tracking branch 'upstream/dev' into dev commit 3be8e40d3814fe8455af475b8641ee07a8f368d6 Merge: c692306f 9d77a3cd Author: Acid Chicken (硫酸鶏) <root@acid-chicken.com> Date: Sun Jan 7 15:05:31 2018 +0900 Merge remote-tracking branch 'upstream/dev' into dev 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 commit 5023357a60bd5ae454b35426ddd279fb3284b7e8 Author: Christopher F <foxbot@protonmail.com> Date: Thu May 24 19:36:33 2018 -0400 codefix #1020: RequestOptions should always be sorted last commit bf5275e071b78a25fd4501a930e69c5dc8cd3b19 Author: Joe4evr <jii.geugten@gmail.com> Date: Thu May 24 19:36:00 2018 -0400 Add ability to specify parameters on channel creation (#1020) commit 07bca5b31a3580d55278878eabb56a82973f8c8f Author: Joe4evr <jii.geugten@gmail.com> Date: Fri Apr 6 09:44:50 2018 +0200 Add ability to specify parameters on channel creation commit 0ba8b063ad98144232606f422574f9741fd95b7a Author: HelpfulStranger999 <helpfulstranger999@gmail.com> Date: Thu May 24 19:23:44 2018 -0400 Makes text parameter of sending messages optional (#1042) commit 114e5b431b26669bcdaac9f84792a216ad67186f Author: HelpfulStranger999 <helpfulstranger999@gmail.com> Date: Sat Apr 28 19:08:35 2018 -0500 Fixes lack of default value for tts commit 1fd8c70c5346ff0c4fdb0093c0fc7fb4b3c8db2c Author: HelpfulStranger999 <helpfulstranger999@gmail.com> Date: Sat Apr 28 15:21:11 2018 -0500 Makes text parameter of sending messages optional commit 79811d0e618c011e6cca542811031d824650dae5 Author: HelpfulStranger999 <helpfulstranger999@gmail.com> Date: Thu May 24 17:35:38 2018 -0500 Paginate reactions - solved #1007 (#1022) * Cleaned up and refactored slightly * Resolves #971 * Adds support for default avatars and resolves #971 * Amendment * Final amendment * Paginating reactions * Amendments based on feedback * Further amendment based on review * Final(?) amendment * Removes default limit and after user id * Removes fromUserId; cleans up model creation; replaces function with individual parameters commit a9983026f067effeac7108c710ba6917162b7995 Author: Still Hsu <341464@gmail.com> Date: Tue May 22 10:15:49 2018 +0800 Add event docs - MessageReceived - ChannelUpdated/Destroyed/Created commit dece19d89505342e5f8c51317b54be8ce69336c9 Merge: fdaa689a e764dafe Author: Still Hsu <341464@gmail.com> Date: Mon May 21 11:47:47 2018 +0800 Merge branch 'dev' into docs/faq-n-patches-offline commit fdaa689ae8be8e9d2ff5190b6cfed5af244b805b Author: Still Hsu <341464@gmail.com> Date: Wed May 9 06:04:59 2018 +0800 Add explanation for RunMode commit ea82c2537e64d4b75f85d9369e90cb55cfcadcc7 Author: Still Hsu <341464@gmail.com> Date: Tue May 8 16:30:48 2018 +0800 Initial proofread of the articles commit 124f1a267c663fbbb0f2dc23367dd910ae3ba4cc Merge: 25557218 97c89310 Author: Still Hsu <341464@gmail.com> Date: Tue May 8 05:02:01 2018 +0800 Merge branch 'dev' into docs/faq-n-patches-offline commit 25557218dbc9390dbeac108afc153776f52dc26f Author: Still Hsu <341464@gmail.com> Date: Sun May 6 16:11:19 2018 +0800 Add details to SpotifyGame commit c7b236ddf5d7324dd8c1513ccd528a7a45d0031f Author: Still Hsu <341464@gmail.com> Date: Sun May 6 15:58:23 2018 +0800 Add more IGuild docs commit 1bb06cc37b7c2312b0ab111da63026a01da01e42 Author: Still Hsu <341464@gmail.com> Date: Sun May 6 15:40:31 2018 +0800 Replace all langword placements with code block commit ac47d84ea74c81e136434dcc33967fe4cd95c1e6 Author: Still Hsu <341464@gmail.com> Date: Sun May 6 15:22:17 2018 +0800 Replace langword null to code block null instead - Because DocFX sucks at rendering langword commit 0b15bbc54d15c036f770bab818712956c527b4ee Author: Still Hsu <341464@gmail.com> Date: Sun May 6 15:20:34 2018 +0800 Add XML docs commit 65d4e4360eb88e3bc5cc8f0da6135e5ee997af6c Author: Still Hsu <341464@gmail.com> Date: Sun May 6 06:57:53 2018 +0800 Add BaseSocketClient docs commit 8f64c045999c1bb0440bdc818f082e7459756b36 Author: Still Hsu <341464@gmail.com> Date: Sun May 6 06:37:55 2018 +0800 Replace note block commit d8bb9e7aaa1e908ceb9227285c0cebec9add5280 Author: Still Hsu <341464@gmail.com> Date: Sun May 6 06:31:50 2018 +0800 Add warning for bulk-delete endpoint commit adae5ffc9e42343f170d6c869644637587330b59 Author: Still Hsu <341464@gmail.com> Date: Sun May 6 06:07:28 2018 +0800 Fix missing Username prop commit 3e591972cafdffb6692a1b94cf9a63251188df8b Author: Still Hsu <341464@gmail.com> Date: Sun May 6 06:01:34 2018 +0800 Add properties examples to overwrite commit 0ad66f6765addf6d4d25dfbddadeaa542d461403 Author: Still Hsu <341464@gmail.com> Date: Sun May 6 04:55:15 2018 +0800 Fix minor consistencies & redundant impl commit 124efdf7e66ee070fbcdde07ed4f20c717c9c1c0 Author: Still Hsu <341464@gmail.com> Date: Sun May 6 04:40:14 2018 +0800 XML Docs commit 3aa5d363de335444558fdb4bf1bf48a5743bc917 Author: Still Hsu <341464@gmail.com> Date: Sat May 5 18:22:46 2018 +0800 Add 'last modified' plugin Source: https://github.com/Still34/DocFx.Plugin.LastModified Licensed under MIT License commit 2014870dc05dedb6171338d8ae4329eaa4c73f90 Author: Still Hsu <341464@gmail.com> Date: Sat May 5 15:57:40 2018 +0800 Fix letter-casing for files commit f27d659ebeb88348e24e759308933e3983831ad7 Author: Still Hsu <341464@gmail.com> Date: Sat May 5 15:50:00 2018 +0800 Document exposed TypeReaders commit 5a824a5695d72a62e28e0a307a5be446557291be Author: Still Hsu <341464@gmail.com> Date: Sat May 5 15:44:15 2018 +0800 Add missing exceptions commit c2de0c055f3894c795ea7d7da774fb006c752898 Author: Still Hsu <341464@gmail.com> Date: Sat May 5 15:40:16 2018 +0800 Fix seealso for preconditions and add missing descriptions commit 3a7d7ee9552a2c6fea1c32b6f3cd91f6efdd29f5 Author: Still Hsu <341464@gmail.com> Date: Sat May 5 15:36:22 2018 +0800 Minor fixes in documentations + Fix unescaped '<' + Fix typo commit 45839bd982a822dd9da10ceb48989fdb2cd8cd85 Author: Still Hsu <341464@gmail.com> Date: Sat May 5 15:29:47 2018 +0800 Add XML Docs commit 9e6254600cd7bb5b7626025492223717f92501f9 Merge: aea06788 bb4bb138 Author: Still Hsu <341464@gmail.com> Date: Sat May 5 14:48:13 2018 +0800 Merge branch 'dev' into docs/faq-n-patches-offline commit aea067884c81832ad6cd910ff56c550cf3ecad75 Merge: 27dc4831 9ddd7090 Author: Still Hsu <341464@gmail.com> Date: Sat May 5 13:51:07 2018 +0800 Merge branch 'docs/faq-n-patches-offline' of https://github.com/Still34/Discord.Net into docs/faq-n-patches-offline commit 27dc4831e88c952f3ea1f68b18434e16197fdfa9 Author: Still Hsu <341464@gmail.com> Date: Sat May 5 13:50:27 2018 +0800 Add XML Docs commit baa8beb3824ed59fb50d269b9e13721fa9f5a04e Author: Still Hsu <341464@gmail.com> Date: Sat May 5 13:49:42 2018 +0800 Add XML Docs commit 089f97a0101a4ef9194f65b2d4435c0c69dfa87c Author: Still Hsu <341464@gmail.com> Date: Sat May 5 13:43:04 2018 +0800 Add details regarding userbot support commit 9ddd70906aa01015fc76bc2401868e044c4c7cc1 Merge: f197174f 7cfed7ff Author: Still Hsu <341464@gmail.com> Date: Fri May 4 09:37:04 2018 +0800 Merge branch 'dev' into docs/faq-n-patches-offline commit f197174fcc2df1e092b26cd2c8087b602ffb1960 Author: Still Hsu <341464@gmail.com> Date: Fri May 4 09:36:53 2018 +0800 Fix embed docs consistency commit 157acc46955d52809b959b52fb1a04404a6df3a5 Author: Still Hsu <341464@gmail.com> Date: Thu May 3 23:03:35 2018 +0800 Add tag examples commit 57ea571a8115f4b768c2dbbe1f2ef807b0cfd647 Author: Still Hsu <341464@gmail.com> Date: Thu May 3 22:48:33 2018 +0800 Fix sample link & add missing pictures commit 6769c37ad7e664845948c50ce403217a9951ef07 Author: Still Hsu <341464@gmail.com> Date: Thu May 3 22:39:26 2018 +0800 Compress some assets & add OAuth2 URL generator
7 years ago
7 years ago
Squashed commit of the following: commit 17a4af71ee8062966bfe477d4d9ea68b490cfb77 Author: Still Hsu <341464@gmail.com> Date: Tue May 29 17:15:10 2018 +0800 Add documentation for new API version & few events commit f4fb027ea9cab9ba990a55676d8453bea3e68b1a Merge: d74c5287 3acf2a9a Author: Still Hsu <341464@gmail.com> Date: Tue May 29 08:25:41 2018 +0800 Merge remote-tracking branch 'upstream/dev' into docs/faq-n-patches-offline commit 3acf2a9a6bb13d5b75c09babaf7234cb2707f4e8 Author: HelpfulStranger999 <helpfulstranger999@gmail.com> Date: Mon May 28 14:59:30 2018 -0500 Refactors readMessages, fixing from #1033 (#1075) commit 513a489bf82ed4e845ff3df9fe21c06e80bb28b8 Author: Christopher F <foxbot@protonmail.com> Date: Mon May 28 15:45:42 2018 -0400 codefix: add VoiceAPIVersion constant to DiscordConfig commit 9ba38d77966897037cb6355eda2215fd9a235712 Author: Christopher F <foxbot@protonmail.com> Date: Mon May 28 15:35:59 2018 -0400 api: upgrade audio client to VoiceWS v3 commit 64d8938ed5100d4c8f3a2afaec3a6becb53cf9b8 Author: Christopher F <foxbot@protonmail.com> Date: Mon May 28 15:25:46 2018 -0400 fix: Discord does not always send the member on VOICE_STATE_UPDATE some guilds aren't on g250k yet? not sure commit aeb30955932803e88fcd056f817f449e8664715f Author: FiniteReality <digpoealternate@gmail.com> Date: Mon May 28 17:48:38 2018 +0100 Remove Debug.Print call causing tests to fail Forgot to hit save properly... Whoops. commit a718a7d3c234a37d1c792ac84af0ae8dce61c1a5 Author: Christopher F <foxbot@protonmail.com> Date: Mon May 28 12:45:49 2018 -0400 cleanup: Remove ChannelHelper#IsNsfw Closes #1074 This code was not referenced anywhere in the active codebase. commit 0c7cb73b06aba3eaeb811b4671fd0f4a5078a491 Author: FiniteReality <digpoealternate@gmail.com> Date: Mon May 28 17:41:05 2018 +0100 Fix permission-related ViewChannel tests commit 415e2f773978353025ea8b2f6c3d9929601c28c1 Author: FiniteReality <digpoealternate@gmail.com> Date: Mon May 28 17:14:18 2018 +0100 Fix analyzer warnings with tests Use (actual, expected) format for Assert.Equal, fixes analyzer warnings commit b0042606b628e02ffe2bee3135c7ed42c3b8311f Author: FiniteReality <digpoealternate@gmail.com> Date: Mon May 28 17:13:59 2018 +0100 Move RpcCategoryChannel into the correct project commit 683b3f2701087db6d49c3a54c6d99c80ef5b2e5a Author: FiniteReality <digpoealternate@gmail.com> Date: Mon May 28 17:12:28 2018 +0100 Mark ChannelHelper.IsNsfw Obsolete Discord no longer treats channels prefixed with 'nsfw' as NSFW, so we no longer need to have this check. commit d74c52873fb13434bca9dd8b56e74104392cb95d Merge: 341b9588 237ad0f8 Author: Still Hsu <341464@gmail.com> Date: Mon May 28 11:48:47 2018 +0800 Merge branch 'dev' into docs/faq-n-patches-offline commit 237ad0f8675023478ec8ad41c7b6b6fd19ceed2d Author: Christopher F <foxbot@protonmail.com> Date: Sun May 27 18:00:51 2018 -0400 Revert "fix: Properly rethrow exceptions in SocketGuild audio client" This reverts commit adf4da19fc116759c4246c978143987712fa2116. Someone hasn't written c# in a while commit adf4da19fc116759c4246c978143987712fa2116 Author: Christopher F <foxbot@protonmail.com> Date: Sun May 27 17:56:14 2018 -0400 fix: Properly rethrow exceptions in SocketGuild audio client commit c0c565fd7ee03fa569027fff7f17db90d9376b4f Author: Christopher F <foxbot@protonmail.com> Date: Sun May 27 16:45:54 2018 -0400 retain fallback case for if user is still null commit 8fb2c71814fad9bcab1888fb8d66d693cc98a4b1 Author: Christopher F <foxbot@protonmail.com> Date: Sun May 27 16:37:17 2018 -0400 Add new member objects to events commit 341b9588d608bcd7460e751b7b0d2cd83bc42e32 Author: Still Hsu <341464@gmail.com> Date: Sun May 27 19:01:04 2018 +0800 Add documentation commit 2df635e025ef7de2959c232e468f093c103f250f Merge: 180b20dd 9995cab4 Author: Still Hsu <341464@gmail.com> Date: Sun May 27 18:25:51 2018 +0800 Merge pull request #1 from Chris-Johnston/better-documentation-for-quotation-mark-aliases Improve XML docs for commands quotation mark aliases feature commit 180b20dd02edddfe1d279348516f5d54985eb8f0 Author: Still Hsu <341464@gmail.com> Date: Sun May 27 18:19:20 2018 +0800 Add documentation for new INestedChannel commit e9f72b6ece60ffe142266b01f90bd5ae8b00c742 Author: Still Hsu <341464@gmail.com> Date: Sun May 27 18:18:52 2018 +0800 Fix missing service provider in example commit 9995cab40ce542562d87183cff91707bd6f07e60 Merge: a8d3031b 1a146afb Author: Chris Johnston <chris@thejohnstons.net> Date: Sun May 27 01:11:17 2018 -0700 Merge branch 'docs/faq-n-patches-offline' into better-documentation-for-quotation-mark-aliases commit a8d3031b2d73bbe813e83bb439345975d1003b55 Author: Chris Johnston <chris@thejohnstons.net> Date: Sat May 26 23:32:40 2018 -0700 Add explanation that if " is removed then it wont work commit cb7c6d35464bd2d8aa0d5cc0dd20c8a6fa11bb4f Author: Chris Johnston <chris@thejohnstons.net> Date: Sat May 26 23:29:32 2018 -0700 Add reference to CommandServiceConfig from the util docs' commit 110b97513fbd26695674190ab217800490e27185 Author: Chris Johnston <chris@thejohnstons.net> Date: Sat May 26 23:15:01 2018 -0700 Add more XML comments to quotation mark alias map stuff, including an example commit 1a146afbe1f539c210648c39985009bd4ad926b3 Merge: cb57ada8 a06e2126 Author: Still Hsu <341464@gmail.com> Date: Sun May 27 11:25:10 2018 +0800 Merge branch 'dev' into docs/faq-n-patches-offline commit a06e21261c66e7aeacde11911ce5ee1ed6baba2f Author: Chris Johnston <chris@thejohnstons.net> Date: Sat May 26 11:15:09 2018 -0700 Fix ChannelPermissions Modify parameter to be correct default value (#1003) * fix channel permissions modify parameter to use nullable boolean, correct default value * Add general tests for the ChannelPermissions.Modify method to test default values * remove unused cast in tests * add guildpermission modify no param tests * Add no-param modify tests for OverwritePermissions * fix inconsistent parameters in GuildPermissions cstr * Adjust formatting of methods and cstrs with many parameters * remove temp file that was included. no idea what that is * Fix System dependency I should really stop fixing merge conflicts in the github website. commit f9cbff5e42c04aa8a0fe87377ba68aa7d748d873 Author: Chris Johnston <chris@thejohnstons.net> Date: Sat May 26 11:06:35 2018 -0700 Fix #995, Move Category Implementation from IGuildChannel to INestedChannel (#1004) * Fix #995 ICategoryChannel.CategoryID throws NotSupportedException * Add tests * change run mode of TestChannelCategories * Add throw for GetCategoryAsync * Add xml doc explaining why exception is thrown * Add test coverage for text and voice channel categories * initial implementation of INestedChannel * more implementation of INestedChannel design * Add case in RestChannel Create for Category type * set the CategoryID for RestVoiceChannel * rewrite channel category tests to work with existing pattern * remove outdated todo * Make IVoiceChannel implement INestedChannel * remove redundant interface implementation * Add c#7 feature from feedback * Remove redundant GetCategoryAsync methods from socket entities * Added configureawait to async methods * change signature of interface GetCategoryAsync * Add check for cachemode in rest channel GetCategory * remove redundant IGuildChannel interface from ITextChannel and IVoiceChannel commit 4d8764e124cef12af4b0944d185ec22d9683c520 Author: FiniteReality <digpoealternate@gmail.com> Date: Sat May 26 14:11:49 2018 +0100 Refactor RoleInfo types into separate classes - Fixes indentation with a few files (looks like a bad copy+paste job) - Renames RoleInfo to RoleEditInfo - Moves RoleInfo from MemberRoleAuditLogData into its own class All of this should improve docs. commit cb57ada8d9f4a8a8b787ba6990afb08ea81a89a1 Author: Still Hsu <341464@gmail.com> Date: Sat May 26 21:03:07 2018 +0800 Add partial documentation for audit log objects commit afda0cd172a98154bc33b4c27eed65580189785d Author: Still Hsu <341464@gmail.com> Date: Sat May 26 20:47:21 2018 +0800 Add documentation for some REST-based objects commit 098ead93d98ea9e629f9c4d8681a38ad8c1e9a82 Author: Still Hsu <341464@gmail.com> Date: Sat May 26 16:33:38 2018 +0800 Add partial documentation for audit log impl commit 5d1621a9c5ea27d8758e6a6e6dc4b4d6c093ff7a Author: Still Hsu <341464@gmail.com> Date: Sat May 26 16:06:20 2018 +0800 Fix xml docs error commit 596b47e1b8bbdd349df20da7938eaf4581bccb91 Merge: 3f572ccc fa759a22 Author: Still Hsu <341464@gmail.com> Date: Sat May 26 15:54:08 2018 +0800 Merge branch 'dev' into docs/faq-n-patches-offline commit 3f572ccc0d10fbdcc514f5ef0701b06c8b75e7ec Merge: 73ebc025 a9983026 Author: Still Hsu <341464@gmail.com> Date: Sat May 26 15:32:38 2018 +0800 Merge branch 'docs/faq-n-patches-offline' of https://github.com/Still34/Discord.Net into docs/faq-n-patches-offline commit 73ebc0258031ff74770b1f4b4a8c4be9071f703c Author: Still Hsu <341464@gmail.com> Date: Sat May 26 15:32:23 2018 +0800 Fix light theme link color commit fa759a22eac25183eb0fecf6cd0fbbf7f476fa11 Author: Chris Johnston <chris@thejohnstons.net> Date: Fri May 25 06:38:59 2018 -0700 Remove Build Warnings for Obsolete Guild Permission Read Messages (#1067) - Replaces the usages of `ReadMessages` with `ViewChannel` - Renames the read message parameters of `GuildPermissions#Modify` to be view channel as well commit bbbac85c46162d7bb44ecdd68194ab79db25037d Author: Hawx <Hawxy@users.noreply.github.com> Date: Fri May 25 20:14:28 2018 +0800 Update Dependencies and support NS2.0 builds (#1046) * Update deps, fix test warnings. * Support ns2.0 * Fix typo * Remove ns1.1 support * Net.Http and Net.Websockets.Client are not needed in ns2.0 * Move to net46 per volt * Remove ns1.3 constants commit 5f084adf94f3215b6d68c3a8b61cbfad7376f18c Author: HelpfulStranger999 <helpfulstranger999@gmail.com> Date: Thu May 24 19:17:19 2018 -0500 Deprecates ReadMessages, introduces ViewChannel (#1033) * Deprecates ReadMessages, introduces ViewChannel * Adds period and comma somehow missed commit bc6009ec7207e16aedecdc658dc59b8ac02c400e Author: Still Hsu <341464@gmail.com> Date: Fri May 25 08:08:51 2018 +0800 Implement IMessageChannel#DeleteMessageAsync (#996) * Implement DeleteMessageAsync * Refer to MessageHelper instead of duplicating call * Fix refactor error commit cee71ef35a450802ef35090d9eaf167ca39306e8 Author: Chris Johnston <chris@thejohnstons.net> Date: Thu May 24 17:07:37 2018 -0700 Add support for parsing multiple types of quotation marks in commands, Fix #942 (#943) * Add ability to support different types of quotation marks * Added normal quotation mark to list of aliases, removed single quote mark * clean up leftover changes from testing * change quotation mark parsing to use a map of matching pairs * remove commented out code * Fix conventions of the command parser utility functions * change storage type of alias dictionary to be IReadOnlyDictionary * revert type of CommandServiceConfig QuotationMarkAliasMap to Dictionary * minor formatting changes to CommandParser * remove unnecessary whitespace * Move aliases outside of CommandInfo class * copy IReadOnlyDictionary to ImmutableDictionary * minor syntax changes in CommandServiceConfig * add newline before namespace for consistency * newline formatting tweak * simplification of GetMatch method for CommandParser * add more quote unicode punctuation pairs * add check for null value when building ImmutableDictionary * Move default alias map into a separate source file * Ensure that the collection passed into command service is not null commit b52af7ae7caaddd79101aeb9f5af2ce482890bc2 Author: Joe4evr <jii.geugten@gmail.com> Date: Fri May 25 01:59:32 2018 +0200 Add a dedicated TimeSpan reader so it doesn't suck (#1005) * Add a dedicated TimeSpan reader so it doesn't suck * Pass input as lower case commit c275e575289073fe42ead725de97b97301c7dc50 Author: o Acid Chicken (硫硫▒~E▒▒▒~O) <root@acid-chicken.com> Date: Thu May 24 19:52:25 2018 -0400 Add support casting System.Drawing.Color to Discord.Color commit fa3303426766a59e7aa4d67e8b50826cfe7204ec Author: Acid Chicken (硫酸鶏) <root@acid-chicken.com> Date: Sun Apr 29 13:50:56 2018 +0900 Use built-in symbol refs: https://github.com/RogueException/Discord.Net/pull/1043#issuecomment-385223999 commit 27ea82668587960925b73f97c924c9d39ee71f7b Author: Acid Chicken (硫酸鶏) <root@acid-chicken.com> Date: Sun Apr 29 11:29:31 2018 +0900 Add support casting System.Drawing.Color to Discord.Color commit 1ab9de24978ff24a018767f80dc95ba19b616988 Merge: f5bb99c7 a4d1e2bc Author: Acid Chicken (硫酸鶏) <root@acid-chicken.com> Date: Sun Apr 29 10:16:46 2018 +0900 Merge remote-tracking branch 'upstream/dev' into dev commit f5bb99c77d0fecec21ad769778d17144c047d8b1 Merge: 3be8e40d b8b59d97 Author: Acid Chicken (硫酸鶏) <root@acid-chicken.com> Date: Tue Apr 10 11:07:36 2018 +0900 Merge remote-tracking branch 'upstream/dev' into dev commit 3be8e40d3814fe8455af475b8641ee07a8f368d6 Merge: c692306f 9d77a3cd Author: Acid Chicken (硫酸鶏) <root@acid-chicken.com> Date: Sun Jan 7 15:05:31 2018 +0900 Merge remote-tracking branch 'upstream/dev' into dev 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 commit 5023357a60bd5ae454b35426ddd279fb3284b7e8 Author: Christopher F <foxbot@protonmail.com> Date: Thu May 24 19:36:33 2018 -0400 codefix #1020: RequestOptions should always be sorted last commit bf5275e071b78a25fd4501a930e69c5dc8cd3b19 Author: Joe4evr <jii.geugten@gmail.com> Date: Thu May 24 19:36:00 2018 -0400 Add ability to specify parameters on channel creation (#1020) commit 07bca5b31a3580d55278878eabb56a82973f8c8f Author: Joe4evr <jii.geugten@gmail.com> Date: Fri Apr 6 09:44:50 2018 +0200 Add ability to specify parameters on channel creation commit 0ba8b063ad98144232606f422574f9741fd95b7a Author: HelpfulStranger999 <helpfulstranger999@gmail.com> Date: Thu May 24 19:23:44 2018 -0400 Makes text parameter of sending messages optional (#1042) commit 114e5b431b26669bcdaac9f84792a216ad67186f Author: HelpfulStranger999 <helpfulstranger999@gmail.com> Date: Sat Apr 28 19:08:35 2018 -0500 Fixes lack of default value for tts commit 1fd8c70c5346ff0c4fdb0093c0fc7fb4b3c8db2c Author: HelpfulStranger999 <helpfulstranger999@gmail.com> Date: Sat Apr 28 15:21:11 2018 -0500 Makes text parameter of sending messages optional commit 79811d0e618c011e6cca542811031d824650dae5 Author: HelpfulStranger999 <helpfulstranger999@gmail.com> Date: Thu May 24 17:35:38 2018 -0500 Paginate reactions - solved #1007 (#1022) * Cleaned up and refactored slightly * Resolves #971 * Adds support for default avatars and resolves #971 * Amendment * Final amendment * Paginating reactions * Amendments based on feedback * Further amendment based on review * Final(?) amendment * Removes default limit and after user id * Removes fromUserId; cleans up model creation; replaces function with individual parameters commit a9983026f067effeac7108c710ba6917162b7995 Author: Still Hsu <341464@gmail.com> Date: Tue May 22 10:15:49 2018 +0800 Add event docs - MessageReceived - ChannelUpdated/Destroyed/Created commit dece19d89505342e5f8c51317b54be8ce69336c9 Merge: fdaa689a e764dafe Author: Still Hsu <341464@gmail.com> Date: Mon May 21 11:47:47 2018 +0800 Merge branch 'dev' into docs/faq-n-patches-offline commit fdaa689ae8be8e9d2ff5190b6cfed5af244b805b Author: Still Hsu <341464@gmail.com> Date: Wed May 9 06:04:59 2018 +0800 Add explanation for RunMode commit ea82c2537e64d4b75f85d9369e90cb55cfcadcc7 Author: Still Hsu <341464@gmail.com> Date: Tue May 8 16:30:48 2018 +0800 Initial proofread of the articles commit 124f1a267c663fbbb0f2dc23367dd910ae3ba4cc Merge: 25557218 97c89310 Author: Still Hsu <341464@gmail.com> Date: Tue May 8 05:02:01 2018 +0800 Merge branch 'dev' into docs/faq-n-patches-offline commit 25557218dbc9390dbeac108afc153776f52dc26f Author: Still Hsu <341464@gmail.com> Date: Sun May 6 16:11:19 2018 +0800 Add details to SpotifyGame commit c7b236ddf5d7324dd8c1513ccd528a7a45d0031f Author: Still Hsu <341464@gmail.com> Date: Sun May 6 15:58:23 2018 +0800 Add more IGuild docs commit 1bb06cc37b7c2312b0ab111da63026a01da01e42 Author: Still Hsu <341464@gmail.com> Date: Sun May 6 15:40:31 2018 +0800 Replace all langword placements with code block commit ac47d84ea74c81e136434dcc33967fe4cd95c1e6 Author: Still Hsu <341464@gmail.com> Date: Sun May 6 15:22:17 2018 +0800 Replace langword null to code block null instead - Because DocFX sucks at rendering langword commit 0b15bbc54d15c036f770bab818712956c527b4ee Author: Still Hsu <341464@gmail.com> Date: Sun May 6 15:20:34 2018 +0800 Add XML docs commit 65d4e4360eb88e3bc5cc8f0da6135e5ee997af6c Author: Still Hsu <341464@gmail.com> Date: Sun May 6 06:57:53 2018 +0800 Add BaseSocketClient docs commit 8f64c045999c1bb0440bdc818f082e7459756b36 Author: Still Hsu <341464@gmail.com> Date: Sun May 6 06:37:55 2018 +0800 Replace note block commit d8bb9e7aaa1e908ceb9227285c0cebec9add5280 Author: Still Hsu <341464@gmail.com> Date: Sun May 6 06:31:50 2018 +0800 Add warning for bulk-delete endpoint commit adae5ffc9e42343f170d6c869644637587330b59 Author: Still Hsu <341464@gmail.com> Date: Sun May 6 06:07:28 2018 +0800 Fix missing Username prop commit 3e591972cafdffb6692a1b94cf9a63251188df8b Author: Still Hsu <341464@gmail.com> Date: Sun May 6 06:01:34 2018 +0800 Add properties examples to overwrite commit 0ad66f6765addf6d4d25dfbddadeaa542d461403 Author: Still Hsu <341464@gmail.com> Date: Sun May 6 04:55:15 2018 +0800 Fix minor consistencies & redundant impl commit 124efdf7e66ee070fbcdde07ed4f20c717c9c1c0 Author: Still Hsu <341464@gmail.com> Date: Sun May 6 04:40:14 2018 +0800 XML Docs commit 3aa5d363de335444558fdb4bf1bf48a5743bc917 Author: Still Hsu <341464@gmail.com> Date: Sat May 5 18:22:46 2018 +0800 Add 'last modified' plugin Source: https://github.com/Still34/DocFx.Plugin.LastModified Licensed under MIT License commit 2014870dc05dedb6171338d8ae4329eaa4c73f90 Author: Still Hsu <341464@gmail.com> Date: Sat May 5 15:57:40 2018 +0800 Fix letter-casing for files commit f27d659ebeb88348e24e759308933e3983831ad7 Author: Still Hsu <341464@gmail.com> Date: Sat May 5 15:50:00 2018 +0800 Document exposed TypeReaders commit 5a824a5695d72a62e28e0a307a5be446557291be Author: Still Hsu <341464@gmail.com> Date: Sat May 5 15:44:15 2018 +0800 Add missing exceptions commit c2de0c055f3894c795ea7d7da774fb006c752898 Author: Still Hsu <341464@gmail.com> Date: Sat May 5 15:40:16 2018 +0800 Fix seealso for preconditions and add missing descriptions commit 3a7d7ee9552a2c6fea1c32b6f3cd91f6efdd29f5 Author: Still Hsu <341464@gmail.com> Date: Sat May 5 15:36:22 2018 +0800 Minor fixes in documentations + Fix unescaped '<' + Fix typo commit 45839bd982a822dd9da10ceb48989fdb2cd8cd85 Author: Still Hsu <341464@gmail.com> Date: Sat May 5 15:29:47 2018 +0800 Add XML Docs commit 9e6254600cd7bb5b7626025492223717f92501f9 Merge: aea06788 bb4bb138 Author: Still Hsu <341464@gmail.com> Date: Sat May 5 14:48:13 2018 +0800 Merge branch 'dev' into docs/faq-n-patches-offline commit aea067884c81832ad6cd910ff56c550cf3ecad75 Merge: 27dc4831 9ddd7090 Author: Still Hsu <341464@gmail.com> Date: Sat May 5 13:51:07 2018 +0800 Merge branch 'docs/faq-n-patches-offline' of https://github.com/Still34/Discord.Net into docs/faq-n-patches-offline commit 27dc4831e88c952f3ea1f68b18434e16197fdfa9 Author: Still Hsu <341464@gmail.com> Date: Sat May 5 13:50:27 2018 +0800 Add XML Docs commit baa8beb3824ed59fb50d269b9e13721fa9f5a04e Author: Still Hsu <341464@gmail.com> Date: Sat May 5 13:49:42 2018 +0800 Add XML Docs commit 089f97a0101a4ef9194f65b2d4435c0c69dfa87c Author: Still Hsu <341464@gmail.com> Date: Sat May 5 13:43:04 2018 +0800 Add details regarding userbot support commit 9ddd70906aa01015fc76bc2401868e044c4c7cc1 Merge: f197174f 7cfed7ff Author: Still Hsu <341464@gmail.com> Date: Fri May 4 09:37:04 2018 +0800 Merge branch 'dev' into docs/faq-n-patches-offline commit f197174fcc2df1e092b26cd2c8087b602ffb1960 Author: Still Hsu <341464@gmail.com> Date: Fri May 4 09:36:53 2018 +0800 Fix embed docs consistency commit 157acc46955d52809b959b52fb1a04404a6df3a5 Author: Still Hsu <341464@gmail.com> Date: Thu May 3 23:03:35 2018 +0800 Add tag examples commit 57ea571a8115f4b768c2dbbe1f2ef807b0cfd647 Author: Still Hsu <341464@gmail.com> Date: Thu May 3 22:48:33 2018 +0800 Fix sample link & add missing pictures commit 6769c37ad7e664845948c50ce403217a9951ef07 Author: Still Hsu <341464@gmail.com> Date: Thu May 3 22:39:26 2018 +0800 Compress some assets & add OAuth2 URL generator
7 years ago
8 years ago
8 years ago
7 years ago
7 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. using Discord.Commands.Builders;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Collections.Immutable;
  5. using System.Collections.Concurrent;
  6. using System.Diagnostics;
  7. using System.Linq;
  8. using System.Reflection;
  9. using System.Runtime.ExceptionServices;
  10. using System.Threading.Tasks;
  11. namespace Discord.Commands
  12. {
  13. /// <summary>
  14. /// Provides the information of a command.
  15. /// </summary>
  16. /// <remarks>
  17. /// This object contains the information of a command. This can include the module of the command, various
  18. /// descriptions regarding the command, and its <see cref="RunMode" />.
  19. /// </remarks>
  20. [DebuggerDisplay("{Name,nq}")]
  21. public class CommandInfo
  22. {
  23. private static readonly System.Reflection.MethodInfo _convertParamsMethod = typeof(CommandInfo).GetTypeInfo().GetDeclaredMethod(nameof(ConvertParamsList));
  24. private static readonly ConcurrentDictionary<Type, Func<IEnumerable<object>, object>> _arrayConverters = new ConcurrentDictionary<Type, Func<IEnumerable<object>, object>>();
  25. private readonly CommandService _commandService;
  26. private readonly Func<ICommandContext, object[], IServiceProvider, CommandInfo, Task> _action;
  27. /// <summary>
  28. /// Gets the module that the command belongs in.
  29. /// </summary>
  30. public ModuleInfo Module { get; }
  31. /// <summary>
  32. /// Gets the name of the command. If none is set, the first alias is used.
  33. /// </summary>
  34. public string Name { get; }
  35. /// <summary>
  36. /// Gets the summary of the command.
  37. /// </summary>
  38. /// <remarks>
  39. /// This field returns the summary of the command. <see cref="Summary"/> and <see cref="Remarks"/> can be
  40. /// useful in help commands and various implementation that fetches details of the command for the user.
  41. /// </remarks>
  42. public string Summary { get; }
  43. /// <summary>
  44. /// Gets the remarks of the command.
  45. /// </summary>
  46. /// <remarks>
  47. /// This field returns the summary of the command. <see cref="Summary"/> and <see cref="Remarks"/> can be
  48. /// useful in help commands and various implementation that fetches details of the command for the user.
  49. /// </remarks>
  50. public string Remarks { get; }
  51. /// <summary>
  52. /// Gets the priority of the command. This is used when there are multiple overloads of the command.
  53. /// </summary>
  54. public int Priority { get; }
  55. /// <summary>
  56. /// Indicates whether the command accepts a <see langword="params"/> <see cref="Type"/>[] for its
  57. /// parameter.
  58. /// </summary>
  59. public bool HasVarArgs { get; }
  60. /// <summary>
  61. /// Indicates whether extra arguments should be ignored for this command.
  62. /// </summary>
  63. public bool IgnoreExtraArgs { get; }
  64. /// <summary>
  65. /// Gets the <see cref="RunMode" /> that is being used for the command.
  66. /// </summary>
  67. public RunMode RunMode { get; }
  68. /// <summary>
  69. /// Gets a list of aliases defined by the <see cref="AliasAttribute" /> of the command.
  70. /// </summary>
  71. public IReadOnlyList<string> Aliases { get; }
  72. /// <summary>
  73. /// Gets a list of information about the parameters of the command.
  74. /// </summary>
  75. public IReadOnlyList<ParameterInfo> Parameters { get; }
  76. /// <summary>
  77. /// Gets a list of preconditions defined by the <see cref="PreconditionAttribute" /> of the command.
  78. /// </summary>
  79. public IReadOnlyList<PreconditionAttribute> Preconditions { get; }
  80. /// <summary>
  81. /// Gets a list of attributes of the command.
  82. /// </summary>
  83. public IReadOnlyList<Attribute> Attributes { get; }
  84. internal CommandInfo(CommandBuilder builder, ModuleInfo module, CommandService service)
  85. {
  86. Module = module;
  87. Name = builder.Name;
  88. Summary = builder.Summary;
  89. Remarks = builder.Remarks;
  90. RunMode = (builder.RunMode == RunMode.Default ? service._defaultRunMode : builder.RunMode);
  91. Priority = builder.Priority;
  92. Aliases = module.Aliases
  93. .Permutate(builder.Aliases, (first, second) =>
  94. {
  95. if (first == "")
  96. return second;
  97. else if (second == "")
  98. return first;
  99. else
  100. return first + service._separatorChar + second;
  101. })
  102. .Select(x => service._caseSensitive ? x : x.ToLowerInvariant())
  103. .ToImmutableArray();
  104. Preconditions = builder.Preconditions.ToImmutableArray();
  105. Attributes = builder.Attributes.ToImmutableArray();
  106. Parameters = builder.Parameters.Select(x => x.Build(this)).ToImmutableArray();
  107. HasVarArgs = builder.Parameters.Count > 0 ? builder.Parameters[builder.Parameters.Count - 1].IsMultiple : false;
  108. IgnoreExtraArgs = builder.IgnoreExtraArgs;
  109. _action = builder.Callback;
  110. _commandService = service;
  111. }
  112. public async Task<PreconditionResult> CheckPreconditionsAsync(ICommandContext context, IServiceProvider services = null)
  113. {
  114. services = services ?? EmptyServiceProvider.Instance;
  115. async Task<PreconditionResult> CheckGroups(IEnumerable<PreconditionAttribute> preconditions, string type)
  116. {
  117. foreach (IGrouping<string, PreconditionAttribute> preconditionGroup in preconditions.GroupBy(p => p.Group, StringComparer.Ordinal))
  118. {
  119. if (preconditionGroup.Key == null)
  120. {
  121. foreach (PreconditionAttribute precondition in preconditionGroup)
  122. {
  123. var result = await precondition.CheckPermissionsAsync(context, this, services).ConfigureAwait(false);
  124. if (!result.IsSuccess)
  125. return result;
  126. }
  127. }
  128. else
  129. {
  130. var results = new List<PreconditionResult>();
  131. foreach (PreconditionAttribute precondition in preconditionGroup)
  132. results.Add(await precondition.CheckPermissionsAsync(context, this, services).ConfigureAwait(false));
  133. if (!results.Any(p => p.IsSuccess))
  134. return PreconditionGroupResult.FromError($"{type} precondition group {preconditionGroup.Key} failed.", results);
  135. }
  136. }
  137. return PreconditionGroupResult.FromSuccess();
  138. }
  139. var moduleResult = await CheckGroups(Module.Preconditions, "Module").ConfigureAwait(false);
  140. if (!moduleResult.IsSuccess)
  141. return moduleResult;
  142. var commandResult = await CheckGroups(Preconditions, "Command").ConfigureAwait(false);
  143. if (!commandResult.IsSuccess)
  144. return commandResult;
  145. return PreconditionResult.FromSuccess();
  146. }
  147. public async Task<ParseResult> ParseAsync(ICommandContext context, int startIndex, SearchResult searchResult, PreconditionResult preconditionResult = null, IServiceProvider services = null)
  148. {
  149. services = services ?? EmptyServiceProvider.Instance;
  150. if (!searchResult.IsSuccess)
  151. return ParseResult.FromError(searchResult);
  152. if (preconditionResult != null && !preconditionResult.IsSuccess)
  153. return ParseResult.FromError(preconditionResult);
  154. string input = searchResult.Text.Substring(startIndex);
  155. return await CommandParser.ParseArgsAsync(this, context, _commandService._ignoreExtraArgs, services, input, 0, _commandService._quotationMarkAliasMap).ConfigureAwait(false);
  156. }
  157. public Task<IResult> ExecuteAsync(ICommandContext context, ParseResult parseResult, IServiceProvider services)
  158. {
  159. if (!parseResult.IsSuccess)
  160. return Task.FromResult((IResult)ExecuteResult.FromError(parseResult));
  161. var argList = new object[parseResult.ArgValues.Count];
  162. for (int i = 0; i < parseResult.ArgValues.Count; i++)
  163. {
  164. if (!parseResult.ArgValues[i].IsSuccess)
  165. return Task.FromResult((IResult)ExecuteResult.FromError(parseResult.ArgValues[i]));
  166. argList[i] = parseResult.ArgValues[i].Values.First().Value;
  167. }
  168. var paramList = new object[parseResult.ParamValues.Count];
  169. for (int i = 0; i < parseResult.ParamValues.Count; i++)
  170. {
  171. if (!parseResult.ParamValues[i].IsSuccess)
  172. return Task.FromResult((IResult)ExecuteResult.FromError(parseResult.ParamValues[i]));
  173. paramList[i] = parseResult.ParamValues[i].Values.First().Value;
  174. }
  175. return ExecuteAsync(context, argList, paramList, services);
  176. }
  177. public async Task<IResult> ExecuteAsync(ICommandContext context, IEnumerable<object> argList, IEnumerable<object> paramList, IServiceProvider services)
  178. {
  179. services = services ?? EmptyServiceProvider.Instance;
  180. try
  181. {
  182. object[] args = GenerateArgs(argList, paramList);
  183. for (int position = 0; position < Parameters.Count; position++)
  184. {
  185. var parameter = Parameters[position];
  186. object argument = args[position];
  187. var result = await parameter.CheckPreconditionsAsync(context, argument, services).ConfigureAwait(false);
  188. if (!result.IsSuccess)
  189. return ExecuteResult.FromError(result);
  190. }
  191. switch (RunMode)
  192. {
  193. case RunMode.Sync: //Always sync
  194. return await ExecuteInternalAsync(context, args, services).ConfigureAwait(false);
  195. case RunMode.Async: //Always async
  196. var t2 = Task.Run(async () =>
  197. {
  198. await ExecuteInternalAsync(context, args, services).ConfigureAwait(false);
  199. });
  200. break;
  201. }
  202. return ExecuteResult.FromSuccess();
  203. }
  204. catch (Exception ex)
  205. {
  206. return ExecuteResult.FromError(ex);
  207. }
  208. }
  209. private async Task<IResult> ExecuteInternalAsync(ICommandContext context, object[] args, IServiceProvider services)
  210. {
  211. await Module.Service._cmdLogger.DebugAsync($"Executing {GetLogText(context)}").ConfigureAwait(false);
  212. try
  213. {
  214. var task = _action(context, args, services, this);
  215. if (task is Task<IResult> resultTask)
  216. {
  217. var result = await resultTask.ConfigureAwait(false);
  218. await Module.Service._commandExecutedEvent.InvokeAsync(this, context, result).ConfigureAwait(false);
  219. if (result is RuntimeResult execResult)
  220. return execResult;
  221. }
  222. else if (task is Task<ExecuteResult> execTask)
  223. {
  224. var result = await execTask.ConfigureAwait(false);
  225. await Module.Service._commandExecutedEvent.InvokeAsync(this, context, result).ConfigureAwait(false);
  226. return result;
  227. }
  228. else
  229. {
  230. await task.ConfigureAwait(false);
  231. var result = ExecuteResult.FromSuccess();
  232. await Module.Service._commandExecutedEvent.InvokeAsync(this, context, result).ConfigureAwait(false);
  233. }
  234. var executeResult = ExecuteResult.FromSuccess();
  235. return executeResult;
  236. }
  237. catch (Exception ex)
  238. {
  239. var originalEx = ex;
  240. while (ex is TargetInvocationException) //Happens with void-returning commands
  241. ex = ex.InnerException;
  242. var wrappedEx = new CommandException(this, context, ex);
  243. await Module.Service._cmdLogger.ErrorAsync(wrappedEx).ConfigureAwait(false);
  244. if (Module.Service._throwOnError)
  245. {
  246. if (ex == originalEx)
  247. throw;
  248. else
  249. ExceptionDispatchInfo.Capture(ex).Throw();
  250. }
  251. return ExecuteResult.FromError(CommandError.Exception, ex.Message);
  252. }
  253. finally
  254. {
  255. await Module.Service._cmdLogger.VerboseAsync($"Executed {GetLogText(context)}").ConfigureAwait(false);
  256. }
  257. }
  258. private object[] GenerateArgs(IEnumerable<object> argList, IEnumerable<object> paramsList)
  259. {
  260. int argCount = Parameters.Count;
  261. var array = new object[Parameters.Count];
  262. if (HasVarArgs)
  263. argCount--;
  264. int i = 0;
  265. foreach (object arg in argList)
  266. {
  267. if (i == argCount)
  268. throw new InvalidOperationException("Command was invoked with too many parameters.");
  269. array[i++] = arg;
  270. }
  271. if (i < argCount)
  272. throw new InvalidOperationException("Command was invoked with too few parameters.");
  273. if (HasVarArgs)
  274. {
  275. var func = _arrayConverters.GetOrAdd(Parameters[Parameters.Count - 1].Type, t =>
  276. {
  277. var method = _convertParamsMethod.MakeGenericMethod(t);
  278. return (Func<IEnumerable<object>, object>)method.CreateDelegate(typeof(Func<IEnumerable<object>, object>));
  279. });
  280. array[i] = func(paramsList);
  281. }
  282. return array;
  283. }
  284. private static T[] ConvertParamsList<T>(IEnumerable<object> paramsList)
  285. => paramsList.Cast<T>().ToArray();
  286. internal string GetLogText(ICommandContext context)
  287. {
  288. if (context.Guild != null)
  289. return $"\"{Name}\" for {context.User} in {context.Guild}/{context.Channel}";
  290. else
  291. return $"\"{Name}\" for {context.User} in {context.Channel}";
  292. }
  293. }
  294. }