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.

DiscordRestApiClient.cs 130 kB

8 years ago
Documentation Overhaul (#1161) * Add XML docs * Clean up style switcher * Squash commits on branch docs/faq-n-patches * Fix broken theme selector * Add local image embed instruction * Add a bunch of XML docs * Add a bunch of XML docs * Fix broken search + DocFX by default ships with an older version of jQuery, switching to a newer version confuses parts of the DocFX Javascript. * Minor fixes for CONTRIBUTING.md and README.md * Clean up filterConfig.yml + New config exposes Discord.Net namespace since it has several common public exceptions that may be helpful to users * Add XML docs * Read token from Environment Variable instead of hardcode * Add XMLDocs * Compress some assets & add OAuth2 URL generator * Fix sample link & add missing pictures * Add tag examples * Fix embed docs consistency * Add details regarding userbot support * Add XML Docs * Add XML Docs * Add XML Docs * Minor fixes in documentations + Fix unescaped '<' + Fix typo * Fix seealso for preconditions and add missing descriptions * Add missing exceptions * Document exposed TypeReaders * Fix letter-casing for files * Add 'last modified' plugin Source: https://github.com/Still34/DocFx.Plugin.LastModified Licensed under MIT License * XML Docs * Fix minor consistencies & redundant impl * Add properties examples to overwrite * Fix missing Username prop * Add warning for bulk-delete endpoint * Replace note block * Add BaseSocketClient docs * Add XML docs * Replace langword null to code block null instead - Because DocFX sucks at rendering langword * Replace all langword placements with code block * Add more IGuild docs * Add details to SpotifyGame * Initial proofread of the articles * Add explanation for RunMode * Add event docs - MessageReceived - ChannelUpdated/Destroyed/Created * Fix light theme link color * Fix xml docs error * Add partial documentation for audit log impl * Add documentation for some REST-based objects * Add partial documentation for audit log objects * Add more XML comments to quotation mark alias map stuff, including an example * Add reference to CommandServiceConfig from the util docs' * Add explanation that if " is removed then it wont work * Fix missing service provider in example * Add documentation for new INestedChannel * Add documentation * Add documentation for new API version & few events * Revise guide paragraphs/samples + Fix various formatting. + Provide a more detailed walkthrough for dependency injection. + Add C# note at intro. * Fix typos & formatting * Improve group module example * Small amount to see if I'm doing it right * Remove/cleanup redundant variables * Fix EnterTypingState impl for doc inheritance * Fix Test to resolve changes made in 15b58e * Improve precondition documentation + Add precondition usage sample + Add precondition group usage sample + Move precondition samples to its own sample folder * Move samples to individual folders * Clarify token source * Cleanup styling of README.md for docs * Replace InvalidPathChars for NS1.3 * InvalidPathChars does not exist in NS1.3; replaced with GetInvalidPathChars instead. * Add a missing change for 2c7cc738 * Update LastModified to v1.1.0 & add license * Rewrite installation page for Core 2.1 * Fix anchor link * Bump post-processor to v1.1.1 * Add fixes to partial file & add license * Moved theme-switcher code to scripts partial file + Add author's MIT license to featherlight javascript * Remove unused bootstrap plugin * Bump LastModified plugin * Changed the path from 'lastmodified' to 'last-modified' for consistency * Cleanup README & Contribution guide * Changes to last pr * Fix GetCategoryAsync docs * Proofread and cleanup articles * Change passive voice in "Get Started" to active * Fix improper preposition in Commands Introduction page * Fix minor grammar mistakes in "Your First Bot" (future tense -> present tense/subjunctive mood -> indicative mood/proper noun casing/incorrect noun/add missing article) * Fix minor grammar mistakes in "Installation" (missing article) * no hablo ingles * Try try try again * I'm sure you're having as much fun as I am * Cleanup TOC & fix titles * Improve styling + Change title font to Noto Sans + Add materialized design for commit message box * Add DescriptionGenerator plugin * Add nightly section for clarification * Fix typos in Nightlies & Post-execution * Bump DescriptionGenerator to v1.1.0 + This build adds the functionality of generating managed references' summary into the description tag. * Initial emoji article draft * Add 'additional information' section for emoji article * Add cosmetic changes to the master css * Alter info box color + Add transition to article content * Add clarification in the emoji article * Emphasize that normal emoji string will not translate to its Unicode representation. * Clean up or add some of the samples featured in the article. + Add emoji/emote declaration section for clarification. + Add WebSocket emote sample. - Remove inconsistent styling ('wacky memes' proves to be too out of place). * Improve readability for nightlies article * Move 'Bundled Preconditions' section * Bump LastModified to fix UTC DateTime parsing * Add langwordMapping.yml * Add XML docs * Add VSC workspace rule * The root workspace limits the ruler to 120 characters for member documentations and excludes folders such as 'samples' and 'docs'. * The docs workspace limits the ruler to 70 characters for standard conceptual article to comply with documentation's CONTRIBUTING.md rule, and excludes temprorary folders created by DocFX. * Update CONTRIBUTING.md * Add documentation style rule * Fix styling of several member documentation * Fix ' />' caused by Agent Smith oddities * Fix styling to be more specific about the mention of IDs * Fix exception summary to comply with official Microsoft Docs style * References https://docs.microsoft.com/en-us/dotnet/api/system.argumentnullexception?view=netframework-4.7.2 https://docs.microsoft.com/en-us/dotnet/api/system.platformnotsupportedexception?view=netframework-4.7.2 https://docs.microsoft.com/en-us/dotnet/api/system.badimageformatexception?view=netframework-4.7.2 * Add XML documentations * Shift color return docs * Fix minor docs * Added documentation for SocketDMChannel, SocketGuildChannel, and SocketTextChannel * Add XML docs * Corrections to SocketGuildChannel * Corrections to SocketTextChannel * Corrections to SocketDMChannel * Swapped out 'id' for 'snowflake identifier * Swapped out 'id' for 'snowflake identifier' * SocketDMChannel amendments * SocketGuildChannel amendments * SocketTextChannel amendments * Add XML docs & patch return types + Starting from this commit, all return types for tasks will use style similar to most documentations featured on docs.microsoft.com References: https://docs.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.dbcontext.-ctor?view=efcore-2.1 https://docs.microsoft.com/en-us/dotnet/api/system.io.filestream.readasync?view=netcore-2.1 https://docs.microsoft.com/en-us/dotnet/api/system.io.textwriter.writelineasync?view=netcore-2.1#System_IO_TextWriter_WriteLineAsync_System_Char___ And many more other asynchronous method documentations featured in the latest BCL. * Added documentation for many audit log data types, fixed vowel indefinite articles * Change audit log data types to start with 'Contains' (verb) instead of an article * Fix some documentation issues and document some more audit log data types * Fix English posession * Add XML doc * Documented two more types * Documented RoleCreateAuditLogData * Document remaining audit log data types * Added RestDMChannel documentation * Added RestGuildChannel documentation * Added RestTextChannel documentation * Added RestVoiceChannel documentation * Added RestUser documentation * Added RestRole documentation * Added RestMessage documentation * Slightly better wording * Contains -> Contains a piece of (describe article) * [EN] Present perf. -> past perf. * Add XML docs * Fix arrow alignment * Clarify supported nullable type * Fixed a typo in ISnowflakeEntity * Added RestUser Documentation * Added RestInvite documentation * Add XML docs & minor optimizations * Minor optimization for doc rendering * Rollback font optimization changes * Amendments to RestUser * Added SocketDMChannel documentation * Added RestDMChannel documentation * Added RestGuild documentation * Adjustment to SocketDMChannel * Added minimal descriptions from the API documentation for Integration types * Added obsolete mention to the ReadMessages flag. * Added remarks about 2FA requirement for guild permissions * Added xmldoc for GuildPermission methods * Added xml doc for ToAllowList and ToDenyList * Added specification of how the bits of the color raw value are packed * Added discord API documentation to IConnection interface * I can spell :^) * Fix whitespace in ChannelPermission * fix spacing of values in guildpermission * Made changes to get field descriptions from feedback, added returns tag to IConnection * Added property get standard for IntegrationAccount * Added property get pattern to xml docs and identical returns tag. * Change all color class references to struct ...because it isn't a class. * Add XML docs * Rewrote the returns tags in IGuildIntegration, removed the ones I was unsure about. * Rewrote the rest of the returns tags * Amendments * Cleanup doc for c1d78189 * Added types to <returns> tags where missing * Added second sample for adding reactions * Added some class summaries * Missed a period * Amendments * restored the removed line break * Removed unnecessary see tag * Use consistent quotation marks around subscribers, the name for these users are dependant on the source of where they are integrated from (youtube or twitch), so we should not use a name that is specific to one platform * Add <remarks> tag to the IGuildIntegration xmldocs * Fix grammar issue * Update DescriptionGenerator * Cleanup of https://github.com/Still34/Discord.Net/pull/8 * Cleanup previous PR * Fix for misleading behaviour in the emoji guide + Original lines stated that sending a emoji wrapped in colon will not be parsed, but that was incorrect; replaced with reactions instead of sending messages as the example * Add strings for dictionary in DotSettings * Add XML docs * Fix lots of typos in comments + Geez, I didn't know there were so many. * Add XML docs & rewrite GetMessagesAsync docs This commit rewrites the remarks section of GetMessagesAsync, as well as adding examples to several methods. * Update 'Your First Bot' + This commit reflects the new changes made to the Discord Application Developer Portal after its major update * Initial optimization for DocFX render & add missing files * Add examples in message methods * Cleanup https://github.com/RogueException/Discord.Net/pull/1128 * Fix first bot note * Cleanup FAQ structure * Add XML docs * Update docfx plugins * Fix navbar collapsing issue * Fix broken xref * Cleanup FAQ section + Add introductory paragraphs to each FAQ section. + Add 'missing dependency' entry to commands FAQ. * Split commands FAQ to 'General' and 'DI' sections. * Cleanup https://github.com/RogueException/Discord.Net/pull/1139 * Fix missing namespace * Add missing highlighting css for the light theme * Add additional clarification for installing packages * Add indentation to example for clarity * Cleanup several articles to be more human-friendly and easier to read * Remove RPC-related notes * Cleanup slow-mode-related documentation strings * Add an additional note about cross-guild emote usage * Add CreateTextChannel sample * Add XMLDocs
7 years ago
8 years ago
Documentation Overhaul (#1161) * Add XML docs * Clean up style switcher * Squash commits on branch docs/faq-n-patches * Fix broken theme selector * Add local image embed instruction * Add a bunch of XML docs * Add a bunch of XML docs * Fix broken search + DocFX by default ships with an older version of jQuery, switching to a newer version confuses parts of the DocFX Javascript. * Minor fixes for CONTRIBUTING.md and README.md * Clean up filterConfig.yml + New config exposes Discord.Net namespace since it has several common public exceptions that may be helpful to users * Add XML docs * Read token from Environment Variable instead of hardcode * Add XMLDocs * Compress some assets & add OAuth2 URL generator * Fix sample link & add missing pictures * Add tag examples * Fix embed docs consistency * Add details regarding userbot support * Add XML Docs * Add XML Docs * Add XML Docs * Minor fixes in documentations + Fix unescaped '<' + Fix typo * Fix seealso for preconditions and add missing descriptions * Add missing exceptions * Document exposed TypeReaders * Fix letter-casing for files * Add 'last modified' plugin Source: https://github.com/Still34/DocFx.Plugin.LastModified Licensed under MIT License * XML Docs * Fix minor consistencies & redundant impl * Add properties examples to overwrite * Fix missing Username prop * Add warning for bulk-delete endpoint * Replace note block * Add BaseSocketClient docs * Add XML docs * Replace langword null to code block null instead - Because DocFX sucks at rendering langword * Replace all langword placements with code block * Add more IGuild docs * Add details to SpotifyGame * Initial proofread of the articles * Add explanation for RunMode * Add event docs - MessageReceived - ChannelUpdated/Destroyed/Created * Fix light theme link color * Fix xml docs error * Add partial documentation for audit log impl * Add documentation for some REST-based objects * Add partial documentation for audit log objects * Add more XML comments to quotation mark alias map stuff, including an example * Add reference to CommandServiceConfig from the util docs' * Add explanation that if " is removed then it wont work * Fix missing service provider in example * Add documentation for new INestedChannel * Add documentation * Add documentation for new API version & few events * Revise guide paragraphs/samples + Fix various formatting. + Provide a more detailed walkthrough for dependency injection. + Add C# note at intro. * Fix typos & formatting * Improve group module example * Small amount to see if I'm doing it right * Remove/cleanup redundant variables * Fix EnterTypingState impl for doc inheritance * Fix Test to resolve changes made in 15b58e * Improve precondition documentation + Add precondition usage sample + Add precondition group usage sample + Move precondition samples to its own sample folder * Move samples to individual folders * Clarify token source * Cleanup styling of README.md for docs * Replace InvalidPathChars for NS1.3 * InvalidPathChars does not exist in NS1.3; replaced with GetInvalidPathChars instead. * Add a missing change for 2c7cc738 * Update LastModified to v1.1.0 & add license * Rewrite installation page for Core 2.1 * Fix anchor link * Bump post-processor to v1.1.1 * Add fixes to partial file & add license * Moved theme-switcher code to scripts partial file + Add author's MIT license to featherlight javascript * Remove unused bootstrap plugin * Bump LastModified plugin * Changed the path from 'lastmodified' to 'last-modified' for consistency * Cleanup README & Contribution guide * Changes to last pr * Fix GetCategoryAsync docs * Proofread and cleanup articles * Change passive voice in "Get Started" to active * Fix improper preposition in Commands Introduction page * Fix minor grammar mistakes in "Your First Bot" (future tense -> present tense/subjunctive mood -> indicative mood/proper noun casing/incorrect noun/add missing article) * Fix minor grammar mistakes in "Installation" (missing article) * no hablo ingles * Try try try again * I'm sure you're having as much fun as I am * Cleanup TOC & fix titles * Improve styling + Change title font to Noto Sans + Add materialized design for commit message box * Add DescriptionGenerator plugin * Add nightly section for clarification * Fix typos in Nightlies & Post-execution * Bump DescriptionGenerator to v1.1.0 + This build adds the functionality of generating managed references' summary into the description tag. * Initial emoji article draft * Add 'additional information' section for emoji article * Add cosmetic changes to the master css * Alter info box color + Add transition to article content * Add clarification in the emoji article * Emphasize that normal emoji string will not translate to its Unicode representation. * Clean up or add some of the samples featured in the article. + Add emoji/emote declaration section for clarification. + Add WebSocket emote sample. - Remove inconsistent styling ('wacky memes' proves to be too out of place). * Improve readability for nightlies article * Move 'Bundled Preconditions' section * Bump LastModified to fix UTC DateTime parsing * Add langwordMapping.yml * Add XML docs * Add VSC workspace rule * The root workspace limits the ruler to 120 characters for member documentations and excludes folders such as 'samples' and 'docs'. * The docs workspace limits the ruler to 70 characters for standard conceptual article to comply with documentation's CONTRIBUTING.md rule, and excludes temprorary folders created by DocFX. * Update CONTRIBUTING.md * Add documentation style rule * Fix styling of several member documentation * Fix ' />' caused by Agent Smith oddities * Fix styling to be more specific about the mention of IDs * Fix exception summary to comply with official Microsoft Docs style * References https://docs.microsoft.com/en-us/dotnet/api/system.argumentnullexception?view=netframework-4.7.2 https://docs.microsoft.com/en-us/dotnet/api/system.platformnotsupportedexception?view=netframework-4.7.2 https://docs.microsoft.com/en-us/dotnet/api/system.badimageformatexception?view=netframework-4.7.2 * Add XML documentations * Shift color return docs * Fix minor docs * Added documentation for SocketDMChannel, SocketGuildChannel, and SocketTextChannel * Add XML docs * Corrections to SocketGuildChannel * Corrections to SocketTextChannel * Corrections to SocketDMChannel * Swapped out 'id' for 'snowflake identifier * Swapped out 'id' for 'snowflake identifier' * SocketDMChannel amendments * SocketGuildChannel amendments * SocketTextChannel amendments * Add XML docs & patch return types + Starting from this commit, all return types for tasks will use style similar to most documentations featured on docs.microsoft.com References: https://docs.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.dbcontext.-ctor?view=efcore-2.1 https://docs.microsoft.com/en-us/dotnet/api/system.io.filestream.readasync?view=netcore-2.1 https://docs.microsoft.com/en-us/dotnet/api/system.io.textwriter.writelineasync?view=netcore-2.1#System_IO_TextWriter_WriteLineAsync_System_Char___ And many more other asynchronous method documentations featured in the latest BCL. * Added documentation for many audit log data types, fixed vowel indefinite articles * Change audit log data types to start with 'Contains' (verb) instead of an article * Fix some documentation issues and document some more audit log data types * Fix English posession * Add XML doc * Documented two more types * Documented RoleCreateAuditLogData * Document remaining audit log data types * Added RestDMChannel documentation * Added RestGuildChannel documentation * Added RestTextChannel documentation * Added RestVoiceChannel documentation * Added RestUser documentation * Added RestRole documentation * Added RestMessage documentation * Slightly better wording * Contains -> Contains a piece of (describe article) * [EN] Present perf. -> past perf. * Add XML docs * Fix arrow alignment * Clarify supported nullable type * Fixed a typo in ISnowflakeEntity * Added RestUser Documentation * Added RestInvite documentation * Add XML docs & minor optimizations * Minor optimization for doc rendering * Rollback font optimization changes * Amendments to RestUser * Added SocketDMChannel documentation * Added RestDMChannel documentation * Added RestGuild documentation * Adjustment to SocketDMChannel * Added minimal descriptions from the API documentation for Integration types * Added obsolete mention to the ReadMessages flag. * Added remarks about 2FA requirement for guild permissions * Added xmldoc for GuildPermission methods * Added xml doc for ToAllowList and ToDenyList * Added specification of how the bits of the color raw value are packed * Added discord API documentation to IConnection interface * I can spell :^) * Fix whitespace in ChannelPermission * fix spacing of values in guildpermission * Made changes to get field descriptions from feedback, added returns tag to IConnection * Added property get standard for IntegrationAccount * Added property get pattern to xml docs and identical returns tag. * Change all color class references to struct ...because it isn't a class. * Add XML docs * Rewrote the returns tags in IGuildIntegration, removed the ones I was unsure about. * Rewrote the rest of the returns tags * Amendments * Cleanup doc for c1d78189 * Added types to <returns> tags where missing * Added second sample for adding reactions * Added some class summaries * Missed a period * Amendments * restored the removed line break * Removed unnecessary see tag * Use consistent quotation marks around subscribers, the name for these users are dependant on the source of where they are integrated from (youtube or twitch), so we should not use a name that is specific to one platform * Add <remarks> tag to the IGuildIntegration xmldocs * Fix grammar issue * Update DescriptionGenerator * Cleanup of https://github.com/Still34/Discord.Net/pull/8 * Cleanup previous PR * Fix for misleading behaviour in the emoji guide + Original lines stated that sending a emoji wrapped in colon will not be parsed, but that was incorrect; replaced with reactions instead of sending messages as the example * Add strings for dictionary in DotSettings * Add XML docs * Fix lots of typos in comments + Geez, I didn't know there were so many. * Add XML docs & rewrite GetMessagesAsync docs This commit rewrites the remarks section of GetMessagesAsync, as well as adding examples to several methods. * Update 'Your First Bot' + This commit reflects the new changes made to the Discord Application Developer Portal after its major update * Initial optimization for DocFX render & add missing files * Add examples in message methods * Cleanup https://github.com/RogueException/Discord.Net/pull/1128 * Fix first bot note * Cleanup FAQ structure * Add XML docs * Update docfx plugins * Fix navbar collapsing issue * Fix broken xref * Cleanup FAQ section + Add introductory paragraphs to each FAQ section. + Add 'missing dependency' entry to commands FAQ. * Split commands FAQ to 'General' and 'DI' sections. * Cleanup https://github.com/RogueException/Discord.Net/pull/1139 * Fix missing namespace * Add missing highlighting css for the light theme * Add additional clarification for installing packages * Add indentation to example for clarity * Cleanup several articles to be more human-friendly and easier to read * Remove RPC-related notes * Cleanup slow-mode-related documentation strings * Add an additional note about cross-guild emote usage * Add CreateTextChannel sample * Add XMLDocs
7 years ago
8 years ago
Documentation Overhaul (#1161) * Add XML docs * Clean up style switcher * Squash commits on branch docs/faq-n-patches * Fix broken theme selector * Add local image embed instruction * Add a bunch of XML docs * Add a bunch of XML docs * Fix broken search + DocFX by default ships with an older version of jQuery, switching to a newer version confuses parts of the DocFX Javascript. * Minor fixes for CONTRIBUTING.md and README.md * Clean up filterConfig.yml + New config exposes Discord.Net namespace since it has several common public exceptions that may be helpful to users * Add XML docs * Read token from Environment Variable instead of hardcode * Add XMLDocs * Compress some assets & add OAuth2 URL generator * Fix sample link & add missing pictures * Add tag examples * Fix embed docs consistency * Add details regarding userbot support * Add XML Docs * Add XML Docs * Add XML Docs * Minor fixes in documentations + Fix unescaped '<' + Fix typo * Fix seealso for preconditions and add missing descriptions * Add missing exceptions * Document exposed TypeReaders * Fix letter-casing for files * Add 'last modified' plugin Source: https://github.com/Still34/DocFx.Plugin.LastModified Licensed under MIT License * XML Docs * Fix minor consistencies & redundant impl * Add properties examples to overwrite * Fix missing Username prop * Add warning for bulk-delete endpoint * Replace note block * Add BaseSocketClient docs * Add XML docs * Replace langword null to code block null instead - Because DocFX sucks at rendering langword * Replace all langword placements with code block * Add more IGuild docs * Add details to SpotifyGame * Initial proofread of the articles * Add explanation for RunMode * Add event docs - MessageReceived - ChannelUpdated/Destroyed/Created * Fix light theme link color * Fix xml docs error * Add partial documentation for audit log impl * Add documentation for some REST-based objects * Add partial documentation for audit log objects * Add more XML comments to quotation mark alias map stuff, including an example * Add reference to CommandServiceConfig from the util docs' * Add explanation that if " is removed then it wont work * Fix missing service provider in example * Add documentation for new INestedChannel * Add documentation * Add documentation for new API version & few events * Revise guide paragraphs/samples + Fix various formatting. + Provide a more detailed walkthrough for dependency injection. + Add C# note at intro. * Fix typos & formatting * Improve group module example * Small amount to see if I'm doing it right * Remove/cleanup redundant variables * Fix EnterTypingState impl for doc inheritance * Fix Test to resolve changes made in 15b58e * Improve precondition documentation + Add precondition usage sample + Add precondition group usage sample + Move precondition samples to its own sample folder * Move samples to individual folders * Clarify token source * Cleanup styling of README.md for docs * Replace InvalidPathChars for NS1.3 * InvalidPathChars does not exist in NS1.3; replaced with GetInvalidPathChars instead. * Add a missing change for 2c7cc738 * Update LastModified to v1.1.0 & add license * Rewrite installation page for Core 2.1 * Fix anchor link * Bump post-processor to v1.1.1 * Add fixes to partial file & add license * Moved theme-switcher code to scripts partial file + Add author's MIT license to featherlight javascript * Remove unused bootstrap plugin * Bump LastModified plugin * Changed the path from 'lastmodified' to 'last-modified' for consistency * Cleanup README & Contribution guide * Changes to last pr * Fix GetCategoryAsync docs * Proofread and cleanup articles * Change passive voice in "Get Started" to active * Fix improper preposition in Commands Introduction page * Fix minor grammar mistakes in "Your First Bot" (future tense -> present tense/subjunctive mood -> indicative mood/proper noun casing/incorrect noun/add missing article) * Fix minor grammar mistakes in "Installation" (missing article) * no hablo ingles * Try try try again * I'm sure you're having as much fun as I am * Cleanup TOC & fix titles * Improve styling + Change title font to Noto Sans + Add materialized design for commit message box * Add DescriptionGenerator plugin * Add nightly section for clarification * Fix typos in Nightlies & Post-execution * Bump DescriptionGenerator to v1.1.0 + This build adds the functionality of generating managed references' summary into the description tag. * Initial emoji article draft * Add 'additional information' section for emoji article * Add cosmetic changes to the master css * Alter info box color + Add transition to article content * Add clarification in the emoji article * Emphasize that normal emoji string will not translate to its Unicode representation. * Clean up or add some of the samples featured in the article. + Add emoji/emote declaration section for clarification. + Add WebSocket emote sample. - Remove inconsistent styling ('wacky memes' proves to be too out of place). * Improve readability for nightlies article * Move 'Bundled Preconditions' section * Bump LastModified to fix UTC DateTime parsing * Add langwordMapping.yml * Add XML docs * Add VSC workspace rule * The root workspace limits the ruler to 120 characters for member documentations and excludes folders such as 'samples' and 'docs'. * The docs workspace limits the ruler to 70 characters for standard conceptual article to comply with documentation's CONTRIBUTING.md rule, and excludes temprorary folders created by DocFX. * Update CONTRIBUTING.md * Add documentation style rule * Fix styling of several member documentation * Fix ' />' caused by Agent Smith oddities * Fix styling to be more specific about the mention of IDs * Fix exception summary to comply with official Microsoft Docs style * References https://docs.microsoft.com/en-us/dotnet/api/system.argumentnullexception?view=netframework-4.7.2 https://docs.microsoft.com/en-us/dotnet/api/system.platformnotsupportedexception?view=netframework-4.7.2 https://docs.microsoft.com/en-us/dotnet/api/system.badimageformatexception?view=netframework-4.7.2 * Add XML documentations * Shift color return docs * Fix minor docs * Added documentation for SocketDMChannel, SocketGuildChannel, and SocketTextChannel * Add XML docs * Corrections to SocketGuildChannel * Corrections to SocketTextChannel * Corrections to SocketDMChannel * Swapped out 'id' for 'snowflake identifier * Swapped out 'id' for 'snowflake identifier' * SocketDMChannel amendments * SocketGuildChannel amendments * SocketTextChannel amendments * Add XML docs & patch return types + Starting from this commit, all return types for tasks will use style similar to most documentations featured on docs.microsoft.com References: https://docs.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.dbcontext.-ctor?view=efcore-2.1 https://docs.microsoft.com/en-us/dotnet/api/system.io.filestream.readasync?view=netcore-2.1 https://docs.microsoft.com/en-us/dotnet/api/system.io.textwriter.writelineasync?view=netcore-2.1#System_IO_TextWriter_WriteLineAsync_System_Char___ And many more other asynchronous method documentations featured in the latest BCL. * Added documentation for many audit log data types, fixed vowel indefinite articles * Change audit log data types to start with 'Contains' (verb) instead of an article * Fix some documentation issues and document some more audit log data types * Fix English posession * Add XML doc * Documented two more types * Documented RoleCreateAuditLogData * Document remaining audit log data types * Added RestDMChannel documentation * Added RestGuildChannel documentation * Added RestTextChannel documentation * Added RestVoiceChannel documentation * Added RestUser documentation * Added RestRole documentation * Added RestMessage documentation * Slightly better wording * Contains -> Contains a piece of (describe article) * [EN] Present perf. -> past perf. * Add XML docs * Fix arrow alignment * Clarify supported nullable type * Fixed a typo in ISnowflakeEntity * Added RestUser Documentation * Added RestInvite documentation * Add XML docs & minor optimizations * Minor optimization for doc rendering * Rollback font optimization changes * Amendments to RestUser * Added SocketDMChannel documentation * Added RestDMChannel documentation * Added RestGuild documentation * Adjustment to SocketDMChannel * Added minimal descriptions from the API documentation for Integration types * Added obsolete mention to the ReadMessages flag. * Added remarks about 2FA requirement for guild permissions * Added xmldoc for GuildPermission methods * Added xml doc for ToAllowList and ToDenyList * Added specification of how the bits of the color raw value are packed * Added discord API documentation to IConnection interface * I can spell :^) * Fix whitespace in ChannelPermission * fix spacing of values in guildpermission * Made changes to get field descriptions from feedback, added returns tag to IConnection * Added property get standard for IntegrationAccount * Added property get pattern to xml docs and identical returns tag. * Change all color class references to struct ...because it isn't a class. * Add XML docs * Rewrote the returns tags in IGuildIntegration, removed the ones I was unsure about. * Rewrote the rest of the returns tags * Amendments * Cleanup doc for c1d78189 * Added types to <returns> tags where missing * Added second sample for adding reactions * Added some class summaries * Missed a period * Amendments * restored the removed line break * Removed unnecessary see tag * Use consistent quotation marks around subscribers, the name for these users are dependant on the source of where they are integrated from (youtube or twitch), so we should not use a name that is specific to one platform * Add <remarks> tag to the IGuildIntegration xmldocs * Fix grammar issue * Update DescriptionGenerator * Cleanup of https://github.com/Still34/Discord.Net/pull/8 * Cleanup previous PR * Fix for misleading behaviour in the emoji guide + Original lines stated that sending a emoji wrapped in colon will not be parsed, but that was incorrect; replaced with reactions instead of sending messages as the example * Add strings for dictionary in DotSettings * Add XML docs * Fix lots of typos in comments + Geez, I didn't know there were so many. * Add XML docs & rewrite GetMessagesAsync docs This commit rewrites the remarks section of GetMessagesAsync, as well as adding examples to several methods. * Update 'Your First Bot' + This commit reflects the new changes made to the Discord Application Developer Portal after its major update * Initial optimization for DocFX render & add missing files * Add examples in message methods * Cleanup https://github.com/RogueException/Discord.Net/pull/1128 * Fix first bot note * Cleanup FAQ structure * Add XML docs * Update docfx plugins * Fix navbar collapsing issue * Fix broken xref * Cleanup FAQ section + Add introductory paragraphs to each FAQ section. + Add 'missing dependency' entry to commands FAQ. * Split commands FAQ to 'General' and 'DI' sections. * Cleanup https://github.com/RogueException/Discord.Net/pull/1139 * Fix missing namespace * Add missing highlighting css for the light theme * Add additional clarification for installing packages * Add indentation to example for clarity * Cleanup several articles to be more human-friendly and easier to read * Remove RPC-related notes * Cleanup slow-mode-related documentation strings * Add an additional note about cross-guild emote usage * Add CreateTextChannel sample * Add XMLDocs
7 years ago
8 years ago
8 years ago
docs: Documentation December Update (#1218) * Fix broken link (#11) * Fix typos and improve wording * Add information for IGuildUser + Add GetPermission sample + Add ModifyAsync remarks * Add information for IGuildChannel + Add ModifyAsync remarks + Add GetOverwritePermissionAsync examples * Add warning for Direction.Around * Fix indentations and references * Move IRole.ModifyAsync sample * Add information for IUser + Add example, remarks for Get(Default)AvatarUrl + Add example, remarks for GetOrCreateDMChannelAsync + Add missing remarks/summary/returns for other properties of the class * Change verbs used in IVoiceState summary/remarks * Add additional explanation for IGuildUser.RoleIds * Change verbs used in IMessage summary/remarks * Clarify IUserMessage Add/RemoveReactionAsync samples * Fix command handler sample typo * Add information for DiscordSocketConfig + Add remarks/example to the class + Add remarks to AlwaysDownloadUsers * Fix documentation for SlowMode * Add additional remarks for Guild/TextChannelProperties * Update DocFx.Plugins.LastModified to v1.2.0 This should drastically improve docfx build time. * Add missing dependencies * Update DocFx.Plugins.LastModified to v1.2.1 Improve performance * Update DocFx.Plugins.LastModified to v1.2.2 * Clarify deployment.md + Rewritten .NET Core deployment strategies for better clarification * Split deployment types into framework-dependent and self-contained * Clarify the benefits of using different types of publishing * Include a sample of how to execute dotnet application with the dotnet command in a TIP dialog for visibility * Update post-execution article and samples + This change is to reflect changes made in https://github.com/RogueException/Discord.Net/pull/1164, where CommandInfo is now passed into the CommandExecuted event as an Optional<T> * Update DocFX.Plugin.DescriptionGenerator to v1.1.1 * Adjust according to recent CommandExecuted changes See: + https://github.com/RogueException/Discord.Net/commit/f549da50e0cb491350e2116cbb141c82c460a455 + https://github.com/RogueException/Discord.Net/commit/62607490952511ab5fc41965cea10f9879914c95 * Add further documentation for https://github.com/RogueException/Discord.Net/pull/1037 * Add partial documentation for the precondition helper class * Include CHANGELOG.md in docs * Revise post-execution docs * Fix incorrect Optional<T> usage * Indent some sample code and add a comment reminding the user that the post-execution basic sample code is not ideal. * Streamline docs for Attachment + This commit also adds further explanation for why Embeds and Attachments are read-only collections * Add further documentation for MessageActivity and MessageApplication * Add caching-related docs to ISocketMessageChannel * Add missing documentation inheritance for SyncPermissionsAsync * Streamline documentation process This is done by changing the documentation of the implementations required by interfaces to redirect to the interface method instead (e.g., SocketDMChannel#GetMessagesAsync refer to IMessageChannel.GetMessagesAsync within the remarks of the method). * Cleanup https://github.com/RogueException/Discord.Net/commit/92bf8363ca8f71ba181aaeeb57e2fcfd09448257 * Update src/Discord.Net.Core/Entities/Channels/Direction.cs Co-Authored-By: Still34 <341464@gmail.com> * Update src/Discord.Net.Core/Entities/Channels/Direction.cs Co-Authored-By: Still34 <341464@gmail.com> * Update src/Discord.Net.Core/Entities/Channels/GuildChannelProperties.cs Co-Authored-By: Still34 <341464@gmail.com> * Update src/Discord.Net.WebSocket/DiscordSocketConfig.cs Co-Authored-By: Still34 <341464@gmail.com> * Update according to PR suggestions * Reword sentences of deployment article for clarification & remove mention of portability * Fix typos/grammar errors within TextChannelProperties * Add the logo SVG to the page navbar * Implement changing logo image based on theme color using CSS background image * Add a favicon * use the purple logomark instead of white * hack? set the title to navbar svg to read "Discord.Net Docs"
7 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
Squashed commit of the following: commit 73740e41690a63797d340af90649ad8a07ba9d0e Author: quin lynch <lynchquin@gmail.com> Date: Wed Aug 4 23:17:04 2021 -0300 add sharded events commit dac6ba3603af21f2e4d6f4a3d1397763bf8be62f Merge: 22e3a529 39b7e715 Author: quin lynch <lynchquin@gmail.com> Date: Wed Aug 4 22:16:12 2021 -0300 Merge branch 'feature/stage-channels' of https://github.com/Discord-Net-Labs/Discord.Net-Labs into feature/stage-channels commit 22e3a529e0f997f18f10ed589a645091bdbc423f Author: quin lynch <lynchquin@gmail.com> Date: Wed Aug 4 22:15:03 2021 -0300 Threads pre 2 commit 39b7e715f34f1330c7ba892992a89af961b406f1 Author: Quin Lynch <49576606+quinchs@users.noreply.github.com> Date: Tue Aug 3 20:43:21 2021 -0300 Update README.md commit 56536f64481759b1a49054d18953f96e2daa8573 Author: Quin Lynch <49576606+quinchs@users.noreply.github.com> Date: Tue Aug 3 20:28:27 2021 -0300 Update README.md commit d98e79452c547c3186269c846e2d9df326742926 Author: quin lynch <lynchquin@gmail.com> Date: Sat Jul 31 21:22:56 2021 -0300 Request to speak stuff commit 950fe80cecfceba50e4325c325872ca55a97346b Author: quin lynch <lynchquin@gmail.com> Date: Sat Jul 31 20:59:11 2021 -0300 Rest stage channels commit 360b9436bbcd4e2dd40d11705890b31c4c1a2d7c Author: quin lynch <lynchquin@gmail.com> Date: Sat Jul 31 20:29:38 2021 -0300 Stage channel socket side commit 928edaa03bf24e7536dc0ef1a14835d9a1adcd62 Author: quin lynch <lynchquin@gmail.com> Date: Sat Jul 31 19:19:40 2021 -0300 Add models commit ec58a9b7e8de7cf99560d89bfbfa65ad74c58986 Author: quin lynch <lynchquin@gmail.com> Date: Sat Jul 31 18:59:09 2021 -0300 initial stage channel events
4 years ago
Squashed commit of the following: commit 73740e41690a63797d340af90649ad8a07ba9d0e Author: quin lynch <lynchquin@gmail.com> Date: Wed Aug 4 23:17:04 2021 -0300 add sharded events commit dac6ba3603af21f2e4d6f4a3d1397763bf8be62f Merge: 22e3a529 39b7e715 Author: quin lynch <lynchquin@gmail.com> Date: Wed Aug 4 22:16:12 2021 -0300 Merge branch 'feature/stage-channels' of https://github.com/Discord-Net-Labs/Discord.Net-Labs into feature/stage-channels commit 22e3a529e0f997f18f10ed589a645091bdbc423f Author: quin lynch <lynchquin@gmail.com> Date: Wed Aug 4 22:15:03 2021 -0300 Threads pre 2 commit 39b7e715f34f1330c7ba892992a89af961b406f1 Author: Quin Lynch <49576606+quinchs@users.noreply.github.com> Date: Tue Aug 3 20:43:21 2021 -0300 Update README.md commit 56536f64481759b1a49054d18953f96e2daa8573 Author: Quin Lynch <49576606+quinchs@users.noreply.github.com> Date: Tue Aug 3 20:28:27 2021 -0300 Update README.md commit d98e79452c547c3186269c846e2d9df326742926 Author: quin lynch <lynchquin@gmail.com> Date: Sat Jul 31 21:22:56 2021 -0300 Request to speak stuff commit 950fe80cecfceba50e4325c325872ca55a97346b Author: quin lynch <lynchquin@gmail.com> Date: Sat Jul 31 20:59:11 2021 -0300 Rest stage channels commit 360b9436bbcd4e2dd40d11705890b31c4c1a2d7c Author: quin lynch <lynchquin@gmail.com> Date: Sat Jul 31 20:29:38 2021 -0300 Stage channel socket side commit 928edaa03bf24e7536dc0ef1a14835d9a1adcd62 Author: quin lynch <lynchquin@gmail.com> Date: Sat Jul 31 19:19:40 2021 -0300 Add models commit ec58a9b7e8de7cf99560d89bfbfa65ad74c58986 Author: quin lynch <lynchquin@gmail.com> Date: Sat Jul 31 18:59:09 2021 -0300 initial stage channel events
4 years ago
4 years ago
4 years ago
Documentation Overhaul (#1161) * Add XML docs * Clean up style switcher * Squash commits on branch docs/faq-n-patches * Fix broken theme selector * Add local image embed instruction * Add a bunch of XML docs * Add a bunch of XML docs * Fix broken search + DocFX by default ships with an older version of jQuery, switching to a newer version confuses parts of the DocFX Javascript. * Minor fixes for CONTRIBUTING.md and README.md * Clean up filterConfig.yml + New config exposes Discord.Net namespace since it has several common public exceptions that may be helpful to users * Add XML docs * Read token from Environment Variable instead of hardcode * Add XMLDocs * Compress some assets & add OAuth2 URL generator * Fix sample link & add missing pictures * Add tag examples * Fix embed docs consistency * Add details regarding userbot support * Add XML Docs * Add XML Docs * Add XML Docs * Minor fixes in documentations + Fix unescaped '<' + Fix typo * Fix seealso for preconditions and add missing descriptions * Add missing exceptions * Document exposed TypeReaders * Fix letter-casing for files * Add 'last modified' plugin Source: https://github.com/Still34/DocFx.Plugin.LastModified Licensed under MIT License * XML Docs * Fix minor consistencies & redundant impl * Add properties examples to overwrite * Fix missing Username prop * Add warning for bulk-delete endpoint * Replace note block * Add BaseSocketClient docs * Add XML docs * Replace langword null to code block null instead - Because DocFX sucks at rendering langword * Replace all langword placements with code block * Add more IGuild docs * Add details to SpotifyGame * Initial proofread of the articles * Add explanation for RunMode * Add event docs - MessageReceived - ChannelUpdated/Destroyed/Created * Fix light theme link color * Fix xml docs error * Add partial documentation for audit log impl * Add documentation for some REST-based objects * Add partial documentation for audit log objects * Add more XML comments to quotation mark alias map stuff, including an example * Add reference to CommandServiceConfig from the util docs' * Add explanation that if " is removed then it wont work * Fix missing service provider in example * Add documentation for new INestedChannel * Add documentation * Add documentation for new API version & few events * Revise guide paragraphs/samples + Fix various formatting. + Provide a more detailed walkthrough for dependency injection. + Add C# note at intro. * Fix typos & formatting * Improve group module example * Small amount to see if I'm doing it right * Remove/cleanup redundant variables * Fix EnterTypingState impl for doc inheritance * Fix Test to resolve changes made in 15b58e * Improve precondition documentation + Add precondition usage sample + Add precondition group usage sample + Move precondition samples to its own sample folder * Move samples to individual folders * Clarify token source * Cleanup styling of README.md for docs * Replace InvalidPathChars for NS1.3 * InvalidPathChars does not exist in NS1.3; replaced with GetInvalidPathChars instead. * Add a missing change for 2c7cc738 * Update LastModified to v1.1.0 & add license * Rewrite installation page for Core 2.1 * Fix anchor link * Bump post-processor to v1.1.1 * Add fixes to partial file & add license * Moved theme-switcher code to scripts partial file + Add author's MIT license to featherlight javascript * Remove unused bootstrap plugin * Bump LastModified plugin * Changed the path from 'lastmodified' to 'last-modified' for consistency * Cleanup README & Contribution guide * Changes to last pr * Fix GetCategoryAsync docs * Proofread and cleanup articles * Change passive voice in "Get Started" to active * Fix improper preposition in Commands Introduction page * Fix minor grammar mistakes in "Your First Bot" (future tense -> present tense/subjunctive mood -> indicative mood/proper noun casing/incorrect noun/add missing article) * Fix minor grammar mistakes in "Installation" (missing article) * no hablo ingles * Try try try again * I'm sure you're having as much fun as I am * Cleanup TOC & fix titles * Improve styling + Change title font to Noto Sans + Add materialized design for commit message box * Add DescriptionGenerator plugin * Add nightly section for clarification * Fix typos in Nightlies & Post-execution * Bump DescriptionGenerator to v1.1.0 + This build adds the functionality of generating managed references' summary into the description tag. * Initial emoji article draft * Add 'additional information' section for emoji article * Add cosmetic changes to the master css * Alter info box color + Add transition to article content * Add clarification in the emoji article * Emphasize that normal emoji string will not translate to its Unicode representation. * Clean up or add some of the samples featured in the article. + Add emoji/emote declaration section for clarification. + Add WebSocket emote sample. - Remove inconsistent styling ('wacky memes' proves to be too out of place). * Improve readability for nightlies article * Move 'Bundled Preconditions' section * Bump LastModified to fix UTC DateTime parsing * Add langwordMapping.yml * Add XML docs * Add VSC workspace rule * The root workspace limits the ruler to 120 characters for member documentations and excludes folders such as 'samples' and 'docs'. * The docs workspace limits the ruler to 70 characters for standard conceptual article to comply with documentation's CONTRIBUTING.md rule, and excludes temprorary folders created by DocFX. * Update CONTRIBUTING.md * Add documentation style rule * Fix styling of several member documentation * Fix ' />' caused by Agent Smith oddities * Fix styling to be more specific about the mention of IDs * Fix exception summary to comply with official Microsoft Docs style * References https://docs.microsoft.com/en-us/dotnet/api/system.argumentnullexception?view=netframework-4.7.2 https://docs.microsoft.com/en-us/dotnet/api/system.platformnotsupportedexception?view=netframework-4.7.2 https://docs.microsoft.com/en-us/dotnet/api/system.badimageformatexception?view=netframework-4.7.2 * Add XML documentations * Shift color return docs * Fix minor docs * Added documentation for SocketDMChannel, SocketGuildChannel, and SocketTextChannel * Add XML docs * Corrections to SocketGuildChannel * Corrections to SocketTextChannel * Corrections to SocketDMChannel * Swapped out 'id' for 'snowflake identifier * Swapped out 'id' for 'snowflake identifier' * SocketDMChannel amendments * SocketGuildChannel amendments * SocketTextChannel amendments * Add XML docs & patch return types + Starting from this commit, all return types for tasks will use style similar to most documentations featured on docs.microsoft.com References: https://docs.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.dbcontext.-ctor?view=efcore-2.1 https://docs.microsoft.com/en-us/dotnet/api/system.io.filestream.readasync?view=netcore-2.1 https://docs.microsoft.com/en-us/dotnet/api/system.io.textwriter.writelineasync?view=netcore-2.1#System_IO_TextWriter_WriteLineAsync_System_Char___ And many more other asynchronous method documentations featured in the latest BCL. * Added documentation for many audit log data types, fixed vowel indefinite articles * Change audit log data types to start with 'Contains' (verb) instead of an article * Fix some documentation issues and document some more audit log data types * Fix English posession * Add XML doc * Documented two more types * Documented RoleCreateAuditLogData * Document remaining audit log data types * Added RestDMChannel documentation * Added RestGuildChannel documentation * Added RestTextChannel documentation * Added RestVoiceChannel documentation * Added RestUser documentation * Added RestRole documentation * Added RestMessage documentation * Slightly better wording * Contains -> Contains a piece of (describe article) * [EN] Present perf. -> past perf. * Add XML docs * Fix arrow alignment * Clarify supported nullable type * Fixed a typo in ISnowflakeEntity * Added RestUser Documentation * Added RestInvite documentation * Add XML docs & minor optimizations * Minor optimization for doc rendering * Rollback font optimization changes * Amendments to RestUser * Added SocketDMChannel documentation * Added RestDMChannel documentation * Added RestGuild documentation * Adjustment to SocketDMChannel * Added minimal descriptions from the API documentation for Integration types * Added obsolete mention to the ReadMessages flag. * Added remarks about 2FA requirement for guild permissions * Added xmldoc for GuildPermission methods * Added xml doc for ToAllowList and ToDenyList * Added specification of how the bits of the color raw value are packed * Added discord API documentation to IConnection interface * I can spell :^) * Fix whitespace in ChannelPermission * fix spacing of values in guildpermission * Made changes to get field descriptions from feedback, added returns tag to IConnection * Added property get standard for IntegrationAccount * Added property get pattern to xml docs and identical returns tag. * Change all color class references to struct ...because it isn't a class. * Add XML docs * Rewrote the returns tags in IGuildIntegration, removed the ones I was unsure about. * Rewrote the rest of the returns tags * Amendments * Cleanup doc for c1d78189 * Added types to <returns> tags where missing * Added second sample for adding reactions * Added some class summaries * Missed a period * Amendments * restored the removed line break * Removed unnecessary see tag * Use consistent quotation marks around subscribers, the name for these users are dependant on the source of where they are integrated from (youtube or twitch), so we should not use a name that is specific to one platform * Add <remarks> tag to the IGuildIntegration xmldocs * Fix grammar issue * Update DescriptionGenerator * Cleanup of https://github.com/Still34/Discord.Net/pull/8 * Cleanup previous PR * Fix for misleading behaviour in the emoji guide + Original lines stated that sending a emoji wrapped in colon will not be parsed, but that was incorrect; replaced with reactions instead of sending messages as the example * Add strings for dictionary in DotSettings * Add XML docs * Fix lots of typos in comments + Geez, I didn't know there were so many. * Add XML docs & rewrite GetMessagesAsync docs This commit rewrites the remarks section of GetMessagesAsync, as well as adding examples to several methods. * Update 'Your First Bot' + This commit reflects the new changes made to the Discord Application Developer Portal after its major update * Initial optimization for DocFX render & add missing files * Add examples in message methods * Cleanup https://github.com/RogueException/Discord.Net/pull/1128 * Fix first bot note * Cleanup FAQ structure * Add XML docs * Update docfx plugins * Fix navbar collapsing issue * Fix broken xref * Cleanup FAQ section + Add introductory paragraphs to each FAQ section. + Add 'missing dependency' entry to commands FAQ. * Split commands FAQ to 'General' and 'DI' sections. * Cleanup https://github.com/RogueException/Discord.Net/pull/1139 * Fix missing namespace * Add missing highlighting css for the light theme * Add additional clarification for installing packages * Add indentation to example for clarity * Cleanup several articles to be more human-friendly and easier to read * Remove RPC-related notes * Cleanup slow-mode-related documentation strings * Add an additional note about cross-guild emote usage * Add CreateTextChannel sample * Add XMLDocs
7 years ago
Documentation Overhaul (#1161) * Add XML docs * Clean up style switcher * Squash commits on branch docs/faq-n-patches * Fix broken theme selector * Add local image embed instruction * Add a bunch of XML docs * Add a bunch of XML docs * Fix broken search + DocFX by default ships with an older version of jQuery, switching to a newer version confuses parts of the DocFX Javascript. * Minor fixes for CONTRIBUTING.md and README.md * Clean up filterConfig.yml + New config exposes Discord.Net namespace since it has several common public exceptions that may be helpful to users * Add XML docs * Read token from Environment Variable instead of hardcode * Add XMLDocs * Compress some assets & add OAuth2 URL generator * Fix sample link & add missing pictures * Add tag examples * Fix embed docs consistency * Add details regarding userbot support * Add XML Docs * Add XML Docs * Add XML Docs * Minor fixes in documentations + Fix unescaped '<' + Fix typo * Fix seealso for preconditions and add missing descriptions * Add missing exceptions * Document exposed TypeReaders * Fix letter-casing for files * Add 'last modified' plugin Source: https://github.com/Still34/DocFx.Plugin.LastModified Licensed under MIT License * XML Docs * Fix minor consistencies & redundant impl * Add properties examples to overwrite * Fix missing Username prop * Add warning for bulk-delete endpoint * Replace note block * Add BaseSocketClient docs * Add XML docs * Replace langword null to code block null instead - Because DocFX sucks at rendering langword * Replace all langword placements with code block * Add more IGuild docs * Add details to SpotifyGame * Initial proofread of the articles * Add explanation for RunMode * Add event docs - MessageReceived - ChannelUpdated/Destroyed/Created * Fix light theme link color * Fix xml docs error * Add partial documentation for audit log impl * Add documentation for some REST-based objects * Add partial documentation for audit log objects * Add more XML comments to quotation mark alias map stuff, including an example * Add reference to CommandServiceConfig from the util docs' * Add explanation that if " is removed then it wont work * Fix missing service provider in example * Add documentation for new INestedChannel * Add documentation * Add documentation for new API version & few events * Revise guide paragraphs/samples + Fix various formatting. + Provide a more detailed walkthrough for dependency injection. + Add C# note at intro. * Fix typos & formatting * Improve group module example * Small amount to see if I'm doing it right * Remove/cleanup redundant variables * Fix EnterTypingState impl for doc inheritance * Fix Test to resolve changes made in 15b58e * Improve precondition documentation + Add precondition usage sample + Add precondition group usage sample + Move precondition samples to its own sample folder * Move samples to individual folders * Clarify token source * Cleanup styling of README.md for docs * Replace InvalidPathChars for NS1.3 * InvalidPathChars does not exist in NS1.3; replaced with GetInvalidPathChars instead. * Add a missing change for 2c7cc738 * Update LastModified to v1.1.0 & add license * Rewrite installation page for Core 2.1 * Fix anchor link * Bump post-processor to v1.1.1 * Add fixes to partial file & add license * Moved theme-switcher code to scripts partial file + Add author's MIT license to featherlight javascript * Remove unused bootstrap plugin * Bump LastModified plugin * Changed the path from 'lastmodified' to 'last-modified' for consistency * Cleanup README & Contribution guide * Changes to last pr * Fix GetCategoryAsync docs * Proofread and cleanup articles * Change passive voice in "Get Started" to active * Fix improper preposition in Commands Introduction page * Fix minor grammar mistakes in "Your First Bot" (future tense -> present tense/subjunctive mood -> indicative mood/proper noun casing/incorrect noun/add missing article) * Fix minor grammar mistakes in "Installation" (missing article) * no hablo ingles * Try try try again * I'm sure you're having as much fun as I am * Cleanup TOC & fix titles * Improve styling + Change title font to Noto Sans + Add materialized design for commit message box * Add DescriptionGenerator plugin * Add nightly section for clarification * Fix typos in Nightlies & Post-execution * Bump DescriptionGenerator to v1.1.0 + This build adds the functionality of generating managed references' summary into the description tag. * Initial emoji article draft * Add 'additional information' section for emoji article * Add cosmetic changes to the master css * Alter info box color + Add transition to article content * Add clarification in the emoji article * Emphasize that normal emoji string will not translate to its Unicode representation. * Clean up or add some of the samples featured in the article. + Add emoji/emote declaration section for clarification. + Add WebSocket emote sample. - Remove inconsistent styling ('wacky memes' proves to be too out of place). * Improve readability for nightlies article * Move 'Bundled Preconditions' section * Bump LastModified to fix UTC DateTime parsing * Add langwordMapping.yml * Add XML docs * Add VSC workspace rule * The root workspace limits the ruler to 120 characters for member documentations and excludes folders such as 'samples' and 'docs'. * The docs workspace limits the ruler to 70 characters for standard conceptual article to comply with documentation's CONTRIBUTING.md rule, and excludes temprorary folders created by DocFX. * Update CONTRIBUTING.md * Add documentation style rule * Fix styling of several member documentation * Fix ' />' caused by Agent Smith oddities * Fix styling to be more specific about the mention of IDs * Fix exception summary to comply with official Microsoft Docs style * References https://docs.microsoft.com/en-us/dotnet/api/system.argumentnullexception?view=netframework-4.7.2 https://docs.microsoft.com/en-us/dotnet/api/system.platformnotsupportedexception?view=netframework-4.7.2 https://docs.microsoft.com/en-us/dotnet/api/system.badimageformatexception?view=netframework-4.7.2 * Add XML documentations * Shift color return docs * Fix minor docs * Added documentation for SocketDMChannel, SocketGuildChannel, and SocketTextChannel * Add XML docs * Corrections to SocketGuildChannel * Corrections to SocketTextChannel * Corrections to SocketDMChannel * Swapped out 'id' for 'snowflake identifier * Swapped out 'id' for 'snowflake identifier' * SocketDMChannel amendments * SocketGuildChannel amendments * SocketTextChannel amendments * Add XML docs & patch return types + Starting from this commit, all return types for tasks will use style similar to most documentations featured on docs.microsoft.com References: https://docs.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.dbcontext.-ctor?view=efcore-2.1 https://docs.microsoft.com/en-us/dotnet/api/system.io.filestream.readasync?view=netcore-2.1 https://docs.microsoft.com/en-us/dotnet/api/system.io.textwriter.writelineasync?view=netcore-2.1#System_IO_TextWriter_WriteLineAsync_System_Char___ And many more other asynchronous method documentations featured in the latest BCL. * Added documentation for many audit log data types, fixed vowel indefinite articles * Change audit log data types to start with 'Contains' (verb) instead of an article * Fix some documentation issues and document some more audit log data types * Fix English posession * Add XML doc * Documented two more types * Documented RoleCreateAuditLogData * Document remaining audit log data types * Added RestDMChannel documentation * Added RestGuildChannel documentation * Added RestTextChannel documentation * Added RestVoiceChannel documentation * Added RestUser documentation * Added RestRole documentation * Added RestMessage documentation * Slightly better wording * Contains -> Contains a piece of (describe article) * [EN] Present perf. -> past perf. * Add XML docs * Fix arrow alignment * Clarify supported nullable type * Fixed a typo in ISnowflakeEntity * Added RestUser Documentation * Added RestInvite documentation * Add XML docs & minor optimizations * Minor optimization for doc rendering * Rollback font optimization changes * Amendments to RestUser * Added SocketDMChannel documentation * Added RestDMChannel documentation * Added RestGuild documentation * Adjustment to SocketDMChannel * Added minimal descriptions from the API documentation for Integration types * Added obsolete mention to the ReadMessages flag. * Added remarks about 2FA requirement for guild permissions * Added xmldoc for GuildPermission methods * Added xml doc for ToAllowList and ToDenyList * Added specification of how the bits of the color raw value are packed * Added discord API documentation to IConnection interface * I can spell :^) * Fix whitespace in ChannelPermission * fix spacing of values in guildpermission * Made changes to get field descriptions from feedback, added returns tag to IConnection * Added property get standard for IntegrationAccount * Added property get pattern to xml docs and identical returns tag. * Change all color class references to struct ...because it isn't a class. * Add XML docs * Rewrote the returns tags in IGuildIntegration, removed the ones I was unsure about. * Rewrote the rest of the returns tags * Amendments * Cleanup doc for c1d78189 * Added types to <returns> tags where missing * Added second sample for adding reactions * Added some class summaries * Missed a period * Amendments * restored the removed line break * Removed unnecessary see tag * Use consistent quotation marks around subscribers, the name for these users are dependant on the source of where they are integrated from (youtube or twitch), so we should not use a name that is specific to one platform * Add <remarks> tag to the IGuildIntegration xmldocs * Fix grammar issue * Update DescriptionGenerator * Cleanup of https://github.com/Still34/Discord.Net/pull/8 * Cleanup previous PR * Fix for misleading behaviour in the emoji guide + Original lines stated that sending a emoji wrapped in colon will not be parsed, but that was incorrect; replaced with reactions instead of sending messages as the example * Add strings for dictionary in DotSettings * Add XML docs * Fix lots of typos in comments + Geez, I didn't know there were so many. * Add XML docs & rewrite GetMessagesAsync docs This commit rewrites the remarks section of GetMessagesAsync, as well as adding examples to several methods. * Update 'Your First Bot' + This commit reflects the new changes made to the Discord Application Developer Portal after its major update * Initial optimization for DocFX render & add missing files * Add examples in message methods * Cleanup https://github.com/RogueException/Discord.Net/pull/1128 * Fix first bot note * Cleanup FAQ structure * Add XML docs * Update docfx plugins * Fix navbar collapsing issue * Fix broken xref * Cleanup FAQ section + Add introductory paragraphs to each FAQ section. + Add 'missing dependency' entry to commands FAQ. * Split commands FAQ to 'General' and 'DI' sections. * Cleanup https://github.com/RogueException/Discord.Net/pull/1139 * Fix missing namespace * Add missing highlighting css for the light theme * Add additional clarification for installing packages * Add indentation to example for clarity * Cleanup several articles to be more human-friendly and easier to read * Remove RPC-related notes * Cleanup slow-mode-related documentation strings * Add an additional note about cross-guild emote usage * Add CreateTextChannel sample * Add XMLDocs
7 years ago
9 years ago
Documentation Overhaul (#1161) * Add XML docs * Clean up style switcher * Squash commits on branch docs/faq-n-patches * Fix broken theme selector * Add local image embed instruction * Add a bunch of XML docs * Add a bunch of XML docs * Fix broken search + DocFX by default ships with an older version of jQuery, switching to a newer version confuses parts of the DocFX Javascript. * Minor fixes for CONTRIBUTING.md and README.md * Clean up filterConfig.yml + New config exposes Discord.Net namespace since it has several common public exceptions that may be helpful to users * Add XML docs * Read token from Environment Variable instead of hardcode * Add XMLDocs * Compress some assets & add OAuth2 URL generator * Fix sample link & add missing pictures * Add tag examples * Fix embed docs consistency * Add details regarding userbot support * Add XML Docs * Add XML Docs * Add XML Docs * Minor fixes in documentations + Fix unescaped '<' + Fix typo * Fix seealso for preconditions and add missing descriptions * Add missing exceptions * Document exposed TypeReaders * Fix letter-casing for files * Add 'last modified' plugin Source: https://github.com/Still34/DocFx.Plugin.LastModified Licensed under MIT License * XML Docs * Fix minor consistencies & redundant impl * Add properties examples to overwrite * Fix missing Username prop * Add warning for bulk-delete endpoint * Replace note block * Add BaseSocketClient docs * Add XML docs * Replace langword null to code block null instead - Because DocFX sucks at rendering langword * Replace all langword placements with code block * Add more IGuild docs * Add details to SpotifyGame * Initial proofread of the articles * Add explanation for RunMode * Add event docs - MessageReceived - ChannelUpdated/Destroyed/Created * Fix light theme link color * Fix xml docs error * Add partial documentation for audit log impl * Add documentation for some REST-based objects * Add partial documentation for audit log objects * Add more XML comments to quotation mark alias map stuff, including an example * Add reference to CommandServiceConfig from the util docs' * Add explanation that if " is removed then it wont work * Fix missing service provider in example * Add documentation for new INestedChannel * Add documentation * Add documentation for new API version & few events * Revise guide paragraphs/samples + Fix various formatting. + Provide a more detailed walkthrough for dependency injection. + Add C# note at intro. * Fix typos & formatting * Improve group module example * Small amount to see if I'm doing it right * Remove/cleanup redundant variables * Fix EnterTypingState impl for doc inheritance * Fix Test to resolve changes made in 15b58e * Improve precondition documentation + Add precondition usage sample + Add precondition group usage sample + Move precondition samples to its own sample folder * Move samples to individual folders * Clarify token source * Cleanup styling of README.md for docs * Replace InvalidPathChars for NS1.3 * InvalidPathChars does not exist in NS1.3; replaced with GetInvalidPathChars instead. * Add a missing change for 2c7cc738 * Update LastModified to v1.1.0 & add license * Rewrite installation page for Core 2.1 * Fix anchor link * Bump post-processor to v1.1.1 * Add fixes to partial file & add license * Moved theme-switcher code to scripts partial file + Add author's MIT license to featherlight javascript * Remove unused bootstrap plugin * Bump LastModified plugin * Changed the path from 'lastmodified' to 'last-modified' for consistency * Cleanup README & Contribution guide * Changes to last pr * Fix GetCategoryAsync docs * Proofread and cleanup articles * Change passive voice in "Get Started" to active * Fix improper preposition in Commands Introduction page * Fix minor grammar mistakes in "Your First Bot" (future tense -> present tense/subjunctive mood -> indicative mood/proper noun casing/incorrect noun/add missing article) * Fix minor grammar mistakes in "Installation" (missing article) * no hablo ingles * Try try try again * I'm sure you're having as much fun as I am * Cleanup TOC & fix titles * Improve styling + Change title font to Noto Sans + Add materialized design for commit message box * Add DescriptionGenerator plugin * Add nightly section for clarification * Fix typos in Nightlies & Post-execution * Bump DescriptionGenerator to v1.1.0 + This build adds the functionality of generating managed references' summary into the description tag. * Initial emoji article draft * Add 'additional information' section for emoji article * Add cosmetic changes to the master css * Alter info box color + Add transition to article content * Add clarification in the emoji article * Emphasize that normal emoji string will not translate to its Unicode representation. * Clean up or add some of the samples featured in the article. + Add emoji/emote declaration section for clarification. + Add WebSocket emote sample. - Remove inconsistent styling ('wacky memes' proves to be too out of place). * Improve readability for nightlies article * Move 'Bundled Preconditions' section * Bump LastModified to fix UTC DateTime parsing * Add langwordMapping.yml * Add XML docs * Add VSC workspace rule * The root workspace limits the ruler to 120 characters for member documentations and excludes folders such as 'samples' and 'docs'. * The docs workspace limits the ruler to 70 characters for standard conceptual article to comply with documentation's CONTRIBUTING.md rule, and excludes temprorary folders created by DocFX. * Update CONTRIBUTING.md * Add documentation style rule * Fix styling of several member documentation * Fix ' />' caused by Agent Smith oddities * Fix styling to be more specific about the mention of IDs * Fix exception summary to comply with official Microsoft Docs style * References https://docs.microsoft.com/en-us/dotnet/api/system.argumentnullexception?view=netframework-4.7.2 https://docs.microsoft.com/en-us/dotnet/api/system.platformnotsupportedexception?view=netframework-4.7.2 https://docs.microsoft.com/en-us/dotnet/api/system.badimageformatexception?view=netframework-4.7.2 * Add XML documentations * Shift color return docs * Fix minor docs * Added documentation for SocketDMChannel, SocketGuildChannel, and SocketTextChannel * Add XML docs * Corrections to SocketGuildChannel * Corrections to SocketTextChannel * Corrections to SocketDMChannel * Swapped out 'id' for 'snowflake identifier * Swapped out 'id' for 'snowflake identifier' * SocketDMChannel amendments * SocketGuildChannel amendments * SocketTextChannel amendments * Add XML docs & patch return types + Starting from this commit, all return types for tasks will use style similar to most documentations featured on docs.microsoft.com References: https://docs.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.dbcontext.-ctor?view=efcore-2.1 https://docs.microsoft.com/en-us/dotnet/api/system.io.filestream.readasync?view=netcore-2.1 https://docs.microsoft.com/en-us/dotnet/api/system.io.textwriter.writelineasync?view=netcore-2.1#System_IO_TextWriter_WriteLineAsync_System_Char___ And many more other asynchronous method documentations featured in the latest BCL. * Added documentation for many audit log data types, fixed vowel indefinite articles * Change audit log data types to start with 'Contains' (verb) instead of an article * Fix some documentation issues and document some more audit log data types * Fix English posession * Add XML doc * Documented two more types * Documented RoleCreateAuditLogData * Document remaining audit log data types * Added RestDMChannel documentation * Added RestGuildChannel documentation * Added RestTextChannel documentation * Added RestVoiceChannel documentation * Added RestUser documentation * Added RestRole documentation * Added RestMessage documentation * Slightly better wording * Contains -> Contains a piece of (describe article) * [EN] Present perf. -> past perf. * Add XML docs * Fix arrow alignment * Clarify supported nullable type * Fixed a typo in ISnowflakeEntity * Added RestUser Documentation * Added RestInvite documentation * Add XML docs & minor optimizations * Minor optimization for doc rendering * Rollback font optimization changes * Amendments to RestUser * Added SocketDMChannel documentation * Added RestDMChannel documentation * Added RestGuild documentation * Adjustment to SocketDMChannel * Added minimal descriptions from the API documentation for Integration types * Added obsolete mention to the ReadMessages flag. * Added remarks about 2FA requirement for guild permissions * Added xmldoc for GuildPermission methods * Added xml doc for ToAllowList and ToDenyList * Added specification of how the bits of the color raw value are packed * Added discord API documentation to IConnection interface * I can spell :^) * Fix whitespace in ChannelPermission * fix spacing of values in guildpermission * Made changes to get field descriptions from feedback, added returns tag to IConnection * Added property get standard for IntegrationAccount * Added property get pattern to xml docs and identical returns tag. * Change all color class references to struct ...because it isn't a class. * Add XML docs * Rewrote the returns tags in IGuildIntegration, removed the ones I was unsure about. * Rewrote the rest of the returns tags * Amendments * Cleanup doc for c1d78189 * Added types to <returns> tags where missing * Added second sample for adding reactions * Added some class summaries * Missed a period * Amendments * restored the removed line break * Removed unnecessary see tag * Use consistent quotation marks around subscribers, the name for these users are dependant on the source of where they are integrated from (youtube or twitch), so we should not use a name that is specific to one platform * Add <remarks> tag to the IGuildIntegration xmldocs * Fix grammar issue * Update DescriptionGenerator * Cleanup of https://github.com/Still34/Discord.Net/pull/8 * Cleanup previous PR * Fix for misleading behaviour in the emoji guide + Original lines stated that sending a emoji wrapped in colon will not be parsed, but that was incorrect; replaced with reactions instead of sending messages as the example * Add strings for dictionary in DotSettings * Add XML docs * Fix lots of typos in comments + Geez, I didn't know there were so many. * Add XML docs & rewrite GetMessagesAsync docs This commit rewrites the remarks section of GetMessagesAsync, as well as adding examples to several methods. * Update 'Your First Bot' + This commit reflects the new changes made to the Discord Application Developer Portal after its major update * Initial optimization for DocFX render & add missing files * Add examples in message methods * Cleanup https://github.com/RogueException/Discord.Net/pull/1128 * Fix first bot note * Cleanup FAQ structure * Add XML docs * Update docfx plugins * Fix navbar collapsing issue * Fix broken xref * Cleanup FAQ section + Add introductory paragraphs to each FAQ section. + Add 'missing dependency' entry to commands FAQ. * Split commands FAQ to 'General' and 'DI' sections. * Cleanup https://github.com/RogueException/Discord.Net/pull/1139 * Fix missing namespace * Add missing highlighting css for the light theme * Add additional clarification for installing packages * Add indentation to example for clarity * Cleanup several articles to be more human-friendly and easier to read * Remove RPC-related notes * Cleanup slow-mode-related documentation strings * Add an additional note about cross-guild emote usage * Add CreateTextChannel sample * Add XMLDocs
7 years ago
Documentation Overhaul (#1161) * Add XML docs * Clean up style switcher * Squash commits on branch docs/faq-n-patches * Fix broken theme selector * Add local image embed instruction * Add a bunch of XML docs * Add a bunch of XML docs * Fix broken search + DocFX by default ships with an older version of jQuery, switching to a newer version confuses parts of the DocFX Javascript. * Minor fixes for CONTRIBUTING.md and README.md * Clean up filterConfig.yml + New config exposes Discord.Net namespace since it has several common public exceptions that may be helpful to users * Add XML docs * Read token from Environment Variable instead of hardcode * Add XMLDocs * Compress some assets & add OAuth2 URL generator * Fix sample link & add missing pictures * Add tag examples * Fix embed docs consistency * Add details regarding userbot support * Add XML Docs * Add XML Docs * Add XML Docs * Minor fixes in documentations + Fix unescaped '<' + Fix typo * Fix seealso for preconditions and add missing descriptions * Add missing exceptions * Document exposed TypeReaders * Fix letter-casing for files * Add 'last modified' plugin Source: https://github.com/Still34/DocFx.Plugin.LastModified Licensed under MIT License * XML Docs * Fix minor consistencies & redundant impl * Add properties examples to overwrite * Fix missing Username prop * Add warning for bulk-delete endpoint * Replace note block * Add BaseSocketClient docs * Add XML docs * Replace langword null to code block null instead - Because DocFX sucks at rendering langword * Replace all langword placements with code block * Add more IGuild docs * Add details to SpotifyGame * Initial proofread of the articles * Add explanation for RunMode * Add event docs - MessageReceived - ChannelUpdated/Destroyed/Created * Fix light theme link color * Fix xml docs error * Add partial documentation for audit log impl * Add documentation for some REST-based objects * Add partial documentation for audit log objects * Add more XML comments to quotation mark alias map stuff, including an example * Add reference to CommandServiceConfig from the util docs' * Add explanation that if " is removed then it wont work * Fix missing service provider in example * Add documentation for new INestedChannel * Add documentation * Add documentation for new API version & few events * Revise guide paragraphs/samples + Fix various formatting. + Provide a more detailed walkthrough for dependency injection. + Add C# note at intro. * Fix typos & formatting * Improve group module example * Small amount to see if I'm doing it right * Remove/cleanup redundant variables * Fix EnterTypingState impl for doc inheritance * Fix Test to resolve changes made in 15b58e * Improve precondition documentation + Add precondition usage sample + Add precondition group usage sample + Move precondition samples to its own sample folder * Move samples to individual folders * Clarify token source * Cleanup styling of README.md for docs * Replace InvalidPathChars for NS1.3 * InvalidPathChars does not exist in NS1.3; replaced with GetInvalidPathChars instead. * Add a missing change for 2c7cc738 * Update LastModified to v1.1.0 & add license * Rewrite installation page for Core 2.1 * Fix anchor link * Bump post-processor to v1.1.1 * Add fixes to partial file & add license * Moved theme-switcher code to scripts partial file + Add author's MIT license to featherlight javascript * Remove unused bootstrap plugin * Bump LastModified plugin * Changed the path from 'lastmodified' to 'last-modified' for consistency * Cleanup README & Contribution guide * Changes to last pr * Fix GetCategoryAsync docs * Proofread and cleanup articles * Change passive voice in "Get Started" to active * Fix improper preposition in Commands Introduction page * Fix minor grammar mistakes in "Your First Bot" (future tense -> present tense/subjunctive mood -> indicative mood/proper noun casing/incorrect noun/add missing article) * Fix minor grammar mistakes in "Installation" (missing article) * no hablo ingles * Try try try again * I'm sure you're having as much fun as I am * Cleanup TOC & fix titles * Improve styling + Change title font to Noto Sans + Add materialized design for commit message box * Add DescriptionGenerator plugin * Add nightly section for clarification * Fix typos in Nightlies & Post-execution * Bump DescriptionGenerator to v1.1.0 + This build adds the functionality of generating managed references' summary into the description tag. * Initial emoji article draft * Add 'additional information' section for emoji article * Add cosmetic changes to the master css * Alter info box color + Add transition to article content * Add clarification in the emoji article * Emphasize that normal emoji string will not translate to its Unicode representation. * Clean up or add some of the samples featured in the article. + Add emoji/emote declaration section for clarification. + Add WebSocket emote sample. - Remove inconsistent styling ('wacky memes' proves to be too out of place). * Improve readability for nightlies article * Move 'Bundled Preconditions' section * Bump LastModified to fix UTC DateTime parsing * Add langwordMapping.yml * Add XML docs * Add VSC workspace rule * The root workspace limits the ruler to 120 characters for member documentations and excludes folders such as 'samples' and 'docs'. * The docs workspace limits the ruler to 70 characters for standard conceptual article to comply with documentation's CONTRIBUTING.md rule, and excludes temprorary folders created by DocFX. * Update CONTRIBUTING.md * Add documentation style rule * Fix styling of several member documentation * Fix ' />' caused by Agent Smith oddities * Fix styling to be more specific about the mention of IDs * Fix exception summary to comply with official Microsoft Docs style * References https://docs.microsoft.com/en-us/dotnet/api/system.argumentnullexception?view=netframework-4.7.2 https://docs.microsoft.com/en-us/dotnet/api/system.platformnotsupportedexception?view=netframework-4.7.2 https://docs.microsoft.com/en-us/dotnet/api/system.badimageformatexception?view=netframework-4.7.2 * Add XML documentations * Shift color return docs * Fix minor docs * Added documentation for SocketDMChannel, SocketGuildChannel, and SocketTextChannel * Add XML docs * Corrections to SocketGuildChannel * Corrections to SocketTextChannel * Corrections to SocketDMChannel * Swapped out 'id' for 'snowflake identifier * Swapped out 'id' for 'snowflake identifier' * SocketDMChannel amendments * SocketGuildChannel amendments * SocketTextChannel amendments * Add XML docs & patch return types + Starting from this commit, all return types for tasks will use style similar to most documentations featured on docs.microsoft.com References: https://docs.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.dbcontext.-ctor?view=efcore-2.1 https://docs.microsoft.com/en-us/dotnet/api/system.io.filestream.readasync?view=netcore-2.1 https://docs.microsoft.com/en-us/dotnet/api/system.io.textwriter.writelineasync?view=netcore-2.1#System_IO_TextWriter_WriteLineAsync_System_Char___ And many more other asynchronous method documentations featured in the latest BCL. * Added documentation for many audit log data types, fixed vowel indefinite articles * Change audit log data types to start with 'Contains' (verb) instead of an article * Fix some documentation issues and document some more audit log data types * Fix English posession * Add XML doc * Documented two more types * Documented RoleCreateAuditLogData * Document remaining audit log data types * Added RestDMChannel documentation * Added RestGuildChannel documentation * Added RestTextChannel documentation * Added RestVoiceChannel documentation * Added RestUser documentation * Added RestRole documentation * Added RestMessage documentation * Slightly better wording * Contains -> Contains a piece of (describe article) * [EN] Present perf. -> past perf. * Add XML docs * Fix arrow alignment * Clarify supported nullable type * Fixed a typo in ISnowflakeEntity * Added RestUser Documentation * Added RestInvite documentation * Add XML docs & minor optimizations * Minor optimization for doc rendering * Rollback font optimization changes * Amendments to RestUser * Added SocketDMChannel documentation * Added RestDMChannel documentation * Added RestGuild documentation * Adjustment to SocketDMChannel * Added minimal descriptions from the API documentation for Integration types * Added obsolete mention to the ReadMessages flag. * Added remarks about 2FA requirement for guild permissions * Added xmldoc for GuildPermission methods * Added xml doc for ToAllowList and ToDenyList * Added specification of how the bits of the color raw value are packed * Added discord API documentation to IConnection interface * I can spell :^) * Fix whitespace in ChannelPermission * fix spacing of values in guildpermission * Made changes to get field descriptions from feedback, added returns tag to IConnection * Added property get standard for IntegrationAccount * Added property get pattern to xml docs and identical returns tag. * Change all color class references to struct ...because it isn't a class. * Add XML docs * Rewrote the returns tags in IGuildIntegration, removed the ones I was unsure about. * Rewrote the rest of the returns tags * Amendments * Cleanup doc for c1d78189 * Added types to <returns> tags where missing * Added second sample for adding reactions * Added some class summaries * Missed a period * Amendments * restored the removed line break * Removed unnecessary see tag * Use consistent quotation marks around subscribers, the name for these users are dependant on the source of where they are integrated from (youtube or twitch), so we should not use a name that is specific to one platform * Add <remarks> tag to the IGuildIntegration xmldocs * Fix grammar issue * Update DescriptionGenerator * Cleanup of https://github.com/Still34/Discord.Net/pull/8 * Cleanup previous PR * Fix for misleading behaviour in the emoji guide + Original lines stated that sending a emoji wrapped in colon will not be parsed, but that was incorrect; replaced with reactions instead of sending messages as the example * Add strings for dictionary in DotSettings * Add XML docs * Fix lots of typos in comments + Geez, I didn't know there were so many. * Add XML docs & rewrite GetMessagesAsync docs This commit rewrites the remarks section of GetMessagesAsync, as well as adding examples to several methods. * Update 'Your First Bot' + This commit reflects the new changes made to the Discord Application Developer Portal after its major update * Initial optimization for DocFX render & add missing files * Add examples in message methods * Cleanup https://github.com/RogueException/Discord.Net/pull/1128 * Fix first bot note * Cleanup FAQ structure * Add XML docs * Update docfx plugins * Fix navbar collapsing issue * Fix broken xref * Cleanup FAQ section + Add introductory paragraphs to each FAQ section. + Add 'missing dependency' entry to commands FAQ. * Split commands FAQ to 'General' and 'DI' sections. * Cleanup https://github.com/RogueException/Discord.Net/pull/1139 * Fix missing namespace * Add missing highlighting css for the light theme * Add additional clarification for installing packages * Add indentation to example for clarity * Cleanup several articles to be more human-friendly and easier to read * Remove RPC-related notes * Cleanup slow-mode-related documentation strings * Add an additional note about cross-guild emote usage * Add CreateTextChannel sample * Add XMLDocs
7 years ago
Documentation Overhaul (#1161) * Add XML docs * Clean up style switcher * Squash commits on branch docs/faq-n-patches * Fix broken theme selector * Add local image embed instruction * Add a bunch of XML docs * Add a bunch of XML docs * Fix broken search + DocFX by default ships with an older version of jQuery, switching to a newer version confuses parts of the DocFX Javascript. * Minor fixes for CONTRIBUTING.md and README.md * Clean up filterConfig.yml + New config exposes Discord.Net namespace since it has several common public exceptions that may be helpful to users * Add XML docs * Read token from Environment Variable instead of hardcode * Add XMLDocs * Compress some assets & add OAuth2 URL generator * Fix sample link & add missing pictures * Add tag examples * Fix embed docs consistency * Add details regarding userbot support * Add XML Docs * Add XML Docs * Add XML Docs * Minor fixes in documentations + Fix unescaped '<' + Fix typo * Fix seealso for preconditions and add missing descriptions * Add missing exceptions * Document exposed TypeReaders * Fix letter-casing for files * Add 'last modified' plugin Source: https://github.com/Still34/DocFx.Plugin.LastModified Licensed under MIT License * XML Docs * Fix minor consistencies & redundant impl * Add properties examples to overwrite * Fix missing Username prop * Add warning for bulk-delete endpoint * Replace note block * Add BaseSocketClient docs * Add XML docs * Replace langword null to code block null instead - Because DocFX sucks at rendering langword * Replace all langword placements with code block * Add more IGuild docs * Add details to SpotifyGame * Initial proofread of the articles * Add explanation for RunMode * Add event docs - MessageReceived - ChannelUpdated/Destroyed/Created * Fix light theme link color * Fix xml docs error * Add partial documentation for audit log impl * Add documentation for some REST-based objects * Add partial documentation for audit log objects * Add more XML comments to quotation mark alias map stuff, including an example * Add reference to CommandServiceConfig from the util docs' * Add explanation that if " is removed then it wont work * Fix missing service provider in example * Add documentation for new INestedChannel * Add documentation * Add documentation for new API version & few events * Revise guide paragraphs/samples + Fix various formatting. + Provide a more detailed walkthrough for dependency injection. + Add C# note at intro. * Fix typos & formatting * Improve group module example * Small amount to see if I'm doing it right * Remove/cleanup redundant variables * Fix EnterTypingState impl for doc inheritance * Fix Test to resolve changes made in 15b58e * Improve precondition documentation + Add precondition usage sample + Add precondition group usage sample + Move precondition samples to its own sample folder * Move samples to individual folders * Clarify token source * Cleanup styling of README.md for docs * Replace InvalidPathChars for NS1.3 * InvalidPathChars does not exist in NS1.3; replaced with GetInvalidPathChars instead. * Add a missing change for 2c7cc738 * Update LastModified to v1.1.0 & add license * Rewrite installation page for Core 2.1 * Fix anchor link * Bump post-processor to v1.1.1 * Add fixes to partial file & add license * Moved theme-switcher code to scripts partial file + Add author's MIT license to featherlight javascript * Remove unused bootstrap plugin * Bump LastModified plugin * Changed the path from 'lastmodified' to 'last-modified' for consistency * Cleanup README & Contribution guide * Changes to last pr * Fix GetCategoryAsync docs * Proofread and cleanup articles * Change passive voice in "Get Started" to active * Fix improper preposition in Commands Introduction page * Fix minor grammar mistakes in "Your First Bot" (future tense -> present tense/subjunctive mood -> indicative mood/proper noun casing/incorrect noun/add missing article) * Fix minor grammar mistakes in "Installation" (missing article) * no hablo ingles * Try try try again * I'm sure you're having as much fun as I am * Cleanup TOC & fix titles * Improve styling + Change title font to Noto Sans + Add materialized design for commit message box * Add DescriptionGenerator plugin * Add nightly section for clarification * Fix typos in Nightlies & Post-execution * Bump DescriptionGenerator to v1.1.0 + This build adds the functionality of generating managed references' summary into the description tag. * Initial emoji article draft * Add 'additional information' section for emoji article * Add cosmetic changes to the master css * Alter info box color + Add transition to article content * Add clarification in the emoji article * Emphasize that normal emoji string will not translate to its Unicode representation. * Clean up or add some of the samples featured in the article. + Add emoji/emote declaration section for clarification. + Add WebSocket emote sample. - Remove inconsistent styling ('wacky memes' proves to be too out of place). * Improve readability for nightlies article * Move 'Bundled Preconditions' section * Bump LastModified to fix UTC DateTime parsing * Add langwordMapping.yml * Add XML docs * Add VSC workspace rule * The root workspace limits the ruler to 120 characters for member documentations and excludes folders such as 'samples' and 'docs'. * The docs workspace limits the ruler to 70 characters for standard conceptual article to comply with documentation's CONTRIBUTING.md rule, and excludes temprorary folders created by DocFX. * Update CONTRIBUTING.md * Add documentation style rule * Fix styling of several member documentation * Fix ' />' caused by Agent Smith oddities * Fix styling to be more specific about the mention of IDs * Fix exception summary to comply with official Microsoft Docs style * References https://docs.microsoft.com/en-us/dotnet/api/system.argumentnullexception?view=netframework-4.7.2 https://docs.microsoft.com/en-us/dotnet/api/system.platformnotsupportedexception?view=netframework-4.7.2 https://docs.microsoft.com/en-us/dotnet/api/system.badimageformatexception?view=netframework-4.7.2 * Add XML documentations * Shift color return docs * Fix minor docs * Added documentation for SocketDMChannel, SocketGuildChannel, and SocketTextChannel * Add XML docs * Corrections to SocketGuildChannel * Corrections to SocketTextChannel * Corrections to SocketDMChannel * Swapped out 'id' for 'snowflake identifier * Swapped out 'id' for 'snowflake identifier' * SocketDMChannel amendments * SocketGuildChannel amendments * SocketTextChannel amendments * Add XML docs & patch return types + Starting from this commit, all return types for tasks will use style similar to most documentations featured on docs.microsoft.com References: https://docs.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.dbcontext.-ctor?view=efcore-2.1 https://docs.microsoft.com/en-us/dotnet/api/system.io.filestream.readasync?view=netcore-2.1 https://docs.microsoft.com/en-us/dotnet/api/system.io.textwriter.writelineasync?view=netcore-2.1#System_IO_TextWriter_WriteLineAsync_System_Char___ And many more other asynchronous method documentations featured in the latest BCL. * Added documentation for many audit log data types, fixed vowel indefinite articles * Change audit log data types to start with 'Contains' (verb) instead of an article * Fix some documentation issues and document some more audit log data types * Fix English posession * Add XML doc * Documented two more types * Documented RoleCreateAuditLogData * Document remaining audit log data types * Added RestDMChannel documentation * Added RestGuildChannel documentation * Added RestTextChannel documentation * Added RestVoiceChannel documentation * Added RestUser documentation * Added RestRole documentation * Added RestMessage documentation * Slightly better wording * Contains -> Contains a piece of (describe article) * [EN] Present perf. -> past perf. * Add XML docs * Fix arrow alignment * Clarify supported nullable type * Fixed a typo in ISnowflakeEntity * Added RestUser Documentation * Added RestInvite documentation * Add XML docs & minor optimizations * Minor optimization for doc rendering * Rollback font optimization changes * Amendments to RestUser * Added SocketDMChannel documentation * Added RestDMChannel documentation * Added RestGuild documentation * Adjustment to SocketDMChannel * Added minimal descriptions from the API documentation for Integration types * Added obsolete mention to the ReadMessages flag. * Added remarks about 2FA requirement for guild permissions * Added xmldoc for GuildPermission methods * Added xml doc for ToAllowList and ToDenyList * Added specification of how the bits of the color raw value are packed * Added discord API documentation to IConnection interface * I can spell :^) * Fix whitespace in ChannelPermission * fix spacing of values in guildpermission * Made changes to get field descriptions from feedback, added returns tag to IConnection * Added property get standard for IntegrationAccount * Added property get pattern to xml docs and identical returns tag. * Change all color class references to struct ...because it isn't a class. * Add XML docs * Rewrote the returns tags in IGuildIntegration, removed the ones I was unsure about. * Rewrote the rest of the returns tags * Amendments * Cleanup doc for c1d78189 * Added types to <returns> tags where missing * Added second sample for adding reactions * Added some class summaries * Missed a period * Amendments * restored the removed line break * Removed unnecessary see tag * Use consistent quotation marks around subscribers, the name for these users are dependant on the source of where they are integrated from (youtube or twitch), so we should not use a name that is specific to one platform * Add <remarks> tag to the IGuildIntegration xmldocs * Fix grammar issue * Update DescriptionGenerator * Cleanup of https://github.com/Still34/Discord.Net/pull/8 * Cleanup previous PR * Fix for misleading behaviour in the emoji guide + Original lines stated that sending a emoji wrapped in colon will not be parsed, but that was incorrect; replaced with reactions instead of sending messages as the example * Add strings for dictionary in DotSettings * Add XML docs * Fix lots of typos in comments + Geez, I didn't know there were so many. * Add XML docs & rewrite GetMessagesAsync docs This commit rewrites the remarks section of GetMessagesAsync, as well as adding examples to several methods. * Update 'Your First Bot' + This commit reflects the new changes made to the Discord Application Developer Portal after its major update * Initial optimization for DocFX render & add missing files * Add examples in message methods * Cleanup https://github.com/RogueException/Discord.Net/pull/1128 * Fix first bot note * Cleanup FAQ structure * Add XML docs * Update docfx plugins * Fix navbar collapsing issue * Fix broken xref * Cleanup FAQ section + Add introductory paragraphs to each FAQ section. + Add 'missing dependency' entry to commands FAQ. * Split commands FAQ to 'General' and 'DI' sections. * Cleanup https://github.com/RogueException/Discord.Net/pull/1139 * Fix missing namespace * Add missing highlighting css for the light theme * Add additional clarification for installing packages * Add indentation to example for clarity * Cleanup several articles to be more human-friendly and easier to read * Remove RPC-related notes * Cleanup slow-mode-related documentation strings * Add an additional note about cross-guild emote usage * Add CreateTextChannel sample * Add XMLDocs
7 years ago
Documentation Overhaul (#1161) * Add XML docs * Clean up style switcher * Squash commits on branch docs/faq-n-patches * Fix broken theme selector * Add local image embed instruction * Add a bunch of XML docs * Add a bunch of XML docs * Fix broken search + DocFX by default ships with an older version of jQuery, switching to a newer version confuses parts of the DocFX Javascript. * Minor fixes for CONTRIBUTING.md and README.md * Clean up filterConfig.yml + New config exposes Discord.Net namespace since it has several common public exceptions that may be helpful to users * Add XML docs * Read token from Environment Variable instead of hardcode * Add XMLDocs * Compress some assets & add OAuth2 URL generator * Fix sample link & add missing pictures * Add tag examples * Fix embed docs consistency * Add details regarding userbot support * Add XML Docs * Add XML Docs * Add XML Docs * Minor fixes in documentations + Fix unescaped '<' + Fix typo * Fix seealso for preconditions and add missing descriptions * Add missing exceptions * Document exposed TypeReaders * Fix letter-casing for files * Add 'last modified' plugin Source: https://github.com/Still34/DocFx.Plugin.LastModified Licensed under MIT License * XML Docs * Fix minor consistencies & redundant impl * Add properties examples to overwrite * Fix missing Username prop * Add warning for bulk-delete endpoint * Replace note block * Add BaseSocketClient docs * Add XML docs * Replace langword null to code block null instead - Because DocFX sucks at rendering langword * Replace all langword placements with code block * Add more IGuild docs * Add details to SpotifyGame * Initial proofread of the articles * Add explanation for RunMode * Add event docs - MessageReceived - ChannelUpdated/Destroyed/Created * Fix light theme link color * Fix xml docs error * Add partial documentation for audit log impl * Add documentation for some REST-based objects * Add partial documentation for audit log objects * Add more XML comments to quotation mark alias map stuff, including an example * Add reference to CommandServiceConfig from the util docs' * Add explanation that if " is removed then it wont work * Fix missing service provider in example * Add documentation for new INestedChannel * Add documentation * Add documentation for new API version & few events * Revise guide paragraphs/samples + Fix various formatting. + Provide a more detailed walkthrough for dependency injection. + Add C# note at intro. * Fix typos & formatting * Improve group module example * Small amount to see if I'm doing it right * Remove/cleanup redundant variables * Fix EnterTypingState impl for doc inheritance * Fix Test to resolve changes made in 15b58e * Improve precondition documentation + Add precondition usage sample + Add precondition group usage sample + Move precondition samples to its own sample folder * Move samples to individual folders * Clarify token source * Cleanup styling of README.md for docs * Replace InvalidPathChars for NS1.3 * InvalidPathChars does not exist in NS1.3; replaced with GetInvalidPathChars instead. * Add a missing change for 2c7cc738 * Update LastModified to v1.1.0 & add license * Rewrite installation page for Core 2.1 * Fix anchor link * Bump post-processor to v1.1.1 * Add fixes to partial file & add license * Moved theme-switcher code to scripts partial file + Add author's MIT license to featherlight javascript * Remove unused bootstrap plugin * Bump LastModified plugin * Changed the path from 'lastmodified' to 'last-modified' for consistency * Cleanup README & Contribution guide * Changes to last pr * Fix GetCategoryAsync docs * Proofread and cleanup articles * Change passive voice in "Get Started" to active * Fix improper preposition in Commands Introduction page * Fix minor grammar mistakes in "Your First Bot" (future tense -> present tense/subjunctive mood -> indicative mood/proper noun casing/incorrect noun/add missing article) * Fix minor grammar mistakes in "Installation" (missing article) * no hablo ingles * Try try try again * I'm sure you're having as much fun as I am * Cleanup TOC & fix titles * Improve styling + Change title font to Noto Sans + Add materialized design for commit message box * Add DescriptionGenerator plugin * Add nightly section for clarification * Fix typos in Nightlies & Post-execution * Bump DescriptionGenerator to v1.1.0 + This build adds the functionality of generating managed references' summary into the description tag. * Initial emoji article draft * Add 'additional information' section for emoji article * Add cosmetic changes to the master css * Alter info box color + Add transition to article content * Add clarification in the emoji article * Emphasize that normal emoji string will not translate to its Unicode representation. * Clean up or add some of the samples featured in the article. + Add emoji/emote declaration section for clarification. + Add WebSocket emote sample. - Remove inconsistent styling ('wacky memes' proves to be too out of place). * Improve readability for nightlies article * Move 'Bundled Preconditions' section * Bump LastModified to fix UTC DateTime parsing * Add langwordMapping.yml * Add XML docs * Add VSC workspace rule * The root workspace limits the ruler to 120 characters for member documentations and excludes folders such as 'samples' and 'docs'. * The docs workspace limits the ruler to 70 characters for standard conceptual article to comply with documentation's CONTRIBUTING.md rule, and excludes temprorary folders created by DocFX. * Update CONTRIBUTING.md * Add documentation style rule * Fix styling of several member documentation * Fix ' />' caused by Agent Smith oddities * Fix styling to be more specific about the mention of IDs * Fix exception summary to comply with official Microsoft Docs style * References https://docs.microsoft.com/en-us/dotnet/api/system.argumentnullexception?view=netframework-4.7.2 https://docs.microsoft.com/en-us/dotnet/api/system.platformnotsupportedexception?view=netframework-4.7.2 https://docs.microsoft.com/en-us/dotnet/api/system.badimageformatexception?view=netframework-4.7.2 * Add XML documentations * Shift color return docs * Fix minor docs * Added documentation for SocketDMChannel, SocketGuildChannel, and SocketTextChannel * Add XML docs * Corrections to SocketGuildChannel * Corrections to SocketTextChannel * Corrections to SocketDMChannel * Swapped out 'id' for 'snowflake identifier * Swapped out 'id' for 'snowflake identifier' * SocketDMChannel amendments * SocketGuildChannel amendments * SocketTextChannel amendments * Add XML docs & patch return types + Starting from this commit, all return types for tasks will use style similar to most documentations featured on docs.microsoft.com References: https://docs.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.dbcontext.-ctor?view=efcore-2.1 https://docs.microsoft.com/en-us/dotnet/api/system.io.filestream.readasync?view=netcore-2.1 https://docs.microsoft.com/en-us/dotnet/api/system.io.textwriter.writelineasync?view=netcore-2.1#System_IO_TextWriter_WriteLineAsync_System_Char___ And many more other asynchronous method documentations featured in the latest BCL. * Added documentation for many audit log data types, fixed vowel indefinite articles * Change audit log data types to start with 'Contains' (verb) instead of an article * Fix some documentation issues and document some more audit log data types * Fix English posession * Add XML doc * Documented two more types * Documented RoleCreateAuditLogData * Document remaining audit log data types * Added RestDMChannel documentation * Added RestGuildChannel documentation * Added RestTextChannel documentation * Added RestVoiceChannel documentation * Added RestUser documentation * Added RestRole documentation * Added RestMessage documentation * Slightly better wording * Contains -> Contains a piece of (describe article) * [EN] Present perf. -> past perf. * Add XML docs * Fix arrow alignment * Clarify supported nullable type * Fixed a typo in ISnowflakeEntity * Added RestUser Documentation * Added RestInvite documentation * Add XML docs & minor optimizations * Minor optimization for doc rendering * Rollback font optimization changes * Amendments to RestUser * Added SocketDMChannel documentation * Added RestDMChannel documentation * Added RestGuild documentation * Adjustment to SocketDMChannel * Added minimal descriptions from the API documentation for Integration types * Added obsolete mention to the ReadMessages flag. * Added remarks about 2FA requirement for guild permissions * Added xmldoc for GuildPermission methods * Added xml doc for ToAllowList and ToDenyList * Added specification of how the bits of the color raw value are packed * Added discord API documentation to IConnection interface * I can spell :^) * Fix whitespace in ChannelPermission * fix spacing of values in guildpermission * Made changes to get field descriptions from feedback, added returns tag to IConnection * Added property get standard for IntegrationAccount * Added property get pattern to xml docs and identical returns tag. * Change all color class references to struct ...because it isn't a class. * Add XML docs * Rewrote the returns tags in IGuildIntegration, removed the ones I was unsure about. * Rewrote the rest of the returns tags * Amendments * Cleanup doc for c1d78189 * Added types to <returns> tags where missing * Added second sample for adding reactions * Added some class summaries * Missed a period * Amendments * restored the removed line break * Removed unnecessary see tag * Use consistent quotation marks around subscribers, the name for these users are dependant on the source of where they are integrated from (youtube or twitch), so we should not use a name that is specific to one platform * Add <remarks> tag to the IGuildIntegration xmldocs * Fix grammar issue * Update DescriptionGenerator * Cleanup of https://github.com/Still34/Discord.Net/pull/8 * Cleanup previous PR * Fix for misleading behaviour in the emoji guide + Original lines stated that sending a emoji wrapped in colon will not be parsed, but that was incorrect; replaced with reactions instead of sending messages as the example * Add strings for dictionary in DotSettings * Add XML docs * Fix lots of typos in comments + Geez, I didn't know there were so many. * Add XML docs & rewrite GetMessagesAsync docs This commit rewrites the remarks section of GetMessagesAsync, as well as adding examples to several methods. * Update 'Your First Bot' + This commit reflects the new changes made to the Discord Application Developer Portal after its major update * Initial optimization for DocFX render & add missing files * Add examples in message methods * Cleanup https://github.com/RogueException/Discord.Net/pull/1128 * Fix first bot note * Cleanup FAQ structure * Add XML docs * Update docfx plugins * Fix navbar collapsing issue * Fix broken xref * Cleanup FAQ section + Add introductory paragraphs to each FAQ section. + Add 'missing dependency' entry to commands FAQ. * Split commands FAQ to 'General' and 'DI' sections. * Cleanup https://github.com/RogueException/Discord.Net/pull/1139 * Fix missing namespace * Add missing highlighting css for the light theme * Add additional clarification for installing packages * Add indentation to example for clarity * Cleanup several articles to be more human-friendly and easier to read * Remove RPC-related notes * Cleanup slow-mode-related documentation strings * Add an additional note about cross-guild emote usage * Add CreateTextChannel sample * Add XMLDocs
7 years ago
Documentation Overhaul (#1161) * Add XML docs * Clean up style switcher * Squash commits on branch docs/faq-n-patches * Fix broken theme selector * Add local image embed instruction * Add a bunch of XML docs * Add a bunch of XML docs * Fix broken search + DocFX by default ships with an older version of jQuery, switching to a newer version confuses parts of the DocFX Javascript. * Minor fixes for CONTRIBUTING.md and README.md * Clean up filterConfig.yml + New config exposes Discord.Net namespace since it has several common public exceptions that may be helpful to users * Add XML docs * Read token from Environment Variable instead of hardcode * Add XMLDocs * Compress some assets & add OAuth2 URL generator * Fix sample link & add missing pictures * Add tag examples * Fix embed docs consistency * Add details regarding userbot support * Add XML Docs * Add XML Docs * Add XML Docs * Minor fixes in documentations + Fix unescaped '<' + Fix typo * Fix seealso for preconditions and add missing descriptions * Add missing exceptions * Document exposed TypeReaders * Fix letter-casing for files * Add 'last modified' plugin Source: https://github.com/Still34/DocFx.Plugin.LastModified Licensed under MIT License * XML Docs * Fix minor consistencies & redundant impl * Add properties examples to overwrite * Fix missing Username prop * Add warning for bulk-delete endpoint * Replace note block * Add BaseSocketClient docs * Add XML docs * Replace langword null to code block null instead - Because DocFX sucks at rendering langword * Replace all langword placements with code block * Add more IGuild docs * Add details to SpotifyGame * Initial proofread of the articles * Add explanation for RunMode * Add event docs - MessageReceived - ChannelUpdated/Destroyed/Created * Fix light theme link color * Fix xml docs error * Add partial documentation for audit log impl * Add documentation for some REST-based objects * Add partial documentation for audit log objects * Add more XML comments to quotation mark alias map stuff, including an example * Add reference to CommandServiceConfig from the util docs' * Add explanation that if " is removed then it wont work * Fix missing service provider in example * Add documentation for new INestedChannel * Add documentation * Add documentation for new API version & few events * Revise guide paragraphs/samples + Fix various formatting. + Provide a more detailed walkthrough for dependency injection. + Add C# note at intro. * Fix typos & formatting * Improve group module example * Small amount to see if I'm doing it right * Remove/cleanup redundant variables * Fix EnterTypingState impl for doc inheritance * Fix Test to resolve changes made in 15b58e * Improve precondition documentation + Add precondition usage sample + Add precondition group usage sample + Move precondition samples to its own sample folder * Move samples to individual folders * Clarify token source * Cleanup styling of README.md for docs * Replace InvalidPathChars for NS1.3 * InvalidPathChars does not exist in NS1.3; replaced with GetInvalidPathChars instead. * Add a missing change for 2c7cc738 * Update LastModified to v1.1.0 & add license * Rewrite installation page for Core 2.1 * Fix anchor link * Bump post-processor to v1.1.1 * Add fixes to partial file & add license * Moved theme-switcher code to scripts partial file + Add author's MIT license to featherlight javascript * Remove unused bootstrap plugin * Bump LastModified plugin * Changed the path from 'lastmodified' to 'last-modified' for consistency * Cleanup README & Contribution guide * Changes to last pr * Fix GetCategoryAsync docs * Proofread and cleanup articles * Change passive voice in "Get Started" to active * Fix improper preposition in Commands Introduction page * Fix minor grammar mistakes in "Your First Bot" (future tense -> present tense/subjunctive mood -> indicative mood/proper noun casing/incorrect noun/add missing article) * Fix minor grammar mistakes in "Installation" (missing article) * no hablo ingles * Try try try again * I'm sure you're having as much fun as I am * Cleanup TOC & fix titles * Improve styling + Change title font to Noto Sans + Add materialized design for commit message box * Add DescriptionGenerator plugin * Add nightly section for clarification * Fix typos in Nightlies & Post-execution * Bump DescriptionGenerator to v1.1.0 + This build adds the functionality of generating managed references' summary into the description tag. * Initial emoji article draft * Add 'additional information' section for emoji article * Add cosmetic changes to the master css * Alter info box color + Add transition to article content * Add clarification in the emoji article * Emphasize that normal emoji string will not translate to its Unicode representation. * Clean up or add some of the samples featured in the article. + Add emoji/emote declaration section for clarification. + Add WebSocket emote sample. - Remove inconsistent styling ('wacky memes' proves to be too out of place). * Improve readability for nightlies article * Move 'Bundled Preconditions' section * Bump LastModified to fix UTC DateTime parsing * Add langwordMapping.yml * Add XML docs * Add VSC workspace rule * The root workspace limits the ruler to 120 characters for member documentations and excludes folders such as 'samples' and 'docs'. * The docs workspace limits the ruler to 70 characters for standard conceptual article to comply with documentation's CONTRIBUTING.md rule, and excludes temprorary folders created by DocFX. * Update CONTRIBUTING.md * Add documentation style rule * Fix styling of several member documentation * Fix ' />' caused by Agent Smith oddities * Fix styling to be more specific about the mention of IDs * Fix exception summary to comply with official Microsoft Docs style * References https://docs.microsoft.com/en-us/dotnet/api/system.argumentnullexception?view=netframework-4.7.2 https://docs.microsoft.com/en-us/dotnet/api/system.platformnotsupportedexception?view=netframework-4.7.2 https://docs.microsoft.com/en-us/dotnet/api/system.badimageformatexception?view=netframework-4.7.2 * Add XML documentations * Shift color return docs * Fix minor docs * Added documentation for SocketDMChannel, SocketGuildChannel, and SocketTextChannel * Add XML docs * Corrections to SocketGuildChannel * Corrections to SocketTextChannel * Corrections to SocketDMChannel * Swapped out 'id' for 'snowflake identifier * Swapped out 'id' for 'snowflake identifier' * SocketDMChannel amendments * SocketGuildChannel amendments * SocketTextChannel amendments * Add XML docs & patch return types + Starting from this commit, all return types for tasks will use style similar to most documentations featured on docs.microsoft.com References: https://docs.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.dbcontext.-ctor?view=efcore-2.1 https://docs.microsoft.com/en-us/dotnet/api/system.io.filestream.readasync?view=netcore-2.1 https://docs.microsoft.com/en-us/dotnet/api/system.io.textwriter.writelineasync?view=netcore-2.1#System_IO_TextWriter_WriteLineAsync_System_Char___ And many more other asynchronous method documentations featured in the latest BCL. * Added documentation for many audit log data types, fixed vowel indefinite articles * Change audit log data types to start with 'Contains' (verb) instead of an article * Fix some documentation issues and document some more audit log data types * Fix English posession * Add XML doc * Documented two more types * Documented RoleCreateAuditLogData * Document remaining audit log data types * Added RestDMChannel documentation * Added RestGuildChannel documentation * Added RestTextChannel documentation * Added RestVoiceChannel documentation * Added RestUser documentation * Added RestRole documentation * Added RestMessage documentation * Slightly better wording * Contains -> Contains a piece of (describe article) * [EN] Present perf. -> past perf. * Add XML docs * Fix arrow alignment * Clarify supported nullable type * Fixed a typo in ISnowflakeEntity * Added RestUser Documentation * Added RestInvite documentation * Add XML docs & minor optimizations * Minor optimization for doc rendering * Rollback font optimization changes * Amendments to RestUser * Added SocketDMChannel documentation * Added RestDMChannel documentation * Added RestGuild documentation * Adjustment to SocketDMChannel * Added minimal descriptions from the API documentation for Integration types * Added obsolete mention to the ReadMessages flag. * Added remarks about 2FA requirement for guild permissions * Added xmldoc for GuildPermission methods * Added xml doc for ToAllowList and ToDenyList * Added specification of how the bits of the color raw value are packed * Added discord API documentation to IConnection interface * I can spell :^) * Fix whitespace in ChannelPermission * fix spacing of values in guildpermission * Made changes to get field descriptions from feedback, added returns tag to IConnection * Added property get standard for IntegrationAccount * Added property get pattern to xml docs and identical returns tag. * Change all color class references to struct ...because it isn't a class. * Add XML docs * Rewrote the returns tags in IGuildIntegration, removed the ones I was unsure about. * Rewrote the rest of the returns tags * Amendments * Cleanup doc for c1d78189 * Added types to <returns> tags where missing * Added second sample for adding reactions * Added some class summaries * Missed a period * Amendments * restored the removed line break * Removed unnecessary see tag * Use consistent quotation marks around subscribers, the name for these users are dependant on the source of where they are integrated from (youtube or twitch), so we should not use a name that is specific to one platform * Add <remarks> tag to the IGuildIntegration xmldocs * Fix grammar issue * Update DescriptionGenerator * Cleanup of https://github.com/Still34/Discord.Net/pull/8 * Cleanup previous PR * Fix for misleading behaviour in the emoji guide + Original lines stated that sending a emoji wrapped in colon will not be parsed, but that was incorrect; replaced with reactions instead of sending messages as the example * Add strings for dictionary in DotSettings * Add XML docs * Fix lots of typos in comments + Geez, I didn't know there were so many. * Add XML docs & rewrite GetMessagesAsync docs This commit rewrites the remarks section of GetMessagesAsync, as well as adding examples to several methods. * Update 'Your First Bot' + This commit reflects the new changes made to the Discord Application Developer Portal after its major update * Initial optimization for DocFX render & add missing files * Add examples in message methods * Cleanup https://github.com/RogueException/Discord.Net/pull/1128 * Fix first bot note * Cleanup FAQ structure * Add XML docs * Update docfx plugins * Fix navbar collapsing issue * Fix broken xref * Cleanup FAQ section + Add introductory paragraphs to each FAQ section. + Add 'missing dependency' entry to commands FAQ. * Split commands FAQ to 'General' and 'DI' sections. * Cleanup https://github.com/RogueException/Discord.Net/pull/1139 * Fix missing namespace * Add missing highlighting css for the light theme * Add additional clarification for installing packages * Add indentation to example for clarity * Cleanup several articles to be more human-friendly and easier to read * Remove RPC-related notes * Cleanup slow-mode-related documentation strings * Add an additional note about cross-guild emote usage * Add CreateTextChannel sample * Add XMLDocs
7 years ago
4 years ago
docs: Documentation December Update (#1218) * Fix broken link (#11) * Fix typos and improve wording * Add information for IGuildUser + Add GetPermission sample + Add ModifyAsync remarks * Add information for IGuildChannel + Add ModifyAsync remarks + Add GetOverwritePermissionAsync examples * Add warning for Direction.Around * Fix indentations and references * Move IRole.ModifyAsync sample * Add information for IUser + Add example, remarks for Get(Default)AvatarUrl + Add example, remarks for GetOrCreateDMChannelAsync + Add missing remarks/summary/returns for other properties of the class * Change verbs used in IVoiceState summary/remarks * Add additional explanation for IGuildUser.RoleIds * Change verbs used in IMessage summary/remarks * Clarify IUserMessage Add/RemoveReactionAsync samples * Fix command handler sample typo * Add information for DiscordSocketConfig + Add remarks/example to the class + Add remarks to AlwaysDownloadUsers * Fix documentation for SlowMode * Add additional remarks for Guild/TextChannelProperties * Update DocFx.Plugins.LastModified to v1.2.0 This should drastically improve docfx build time. * Add missing dependencies * Update DocFx.Plugins.LastModified to v1.2.1 Improve performance * Update DocFx.Plugins.LastModified to v1.2.2 * Clarify deployment.md + Rewritten .NET Core deployment strategies for better clarification * Split deployment types into framework-dependent and self-contained * Clarify the benefits of using different types of publishing * Include a sample of how to execute dotnet application with the dotnet command in a TIP dialog for visibility * Update post-execution article and samples + This change is to reflect changes made in https://github.com/RogueException/Discord.Net/pull/1164, where CommandInfo is now passed into the CommandExecuted event as an Optional<T> * Update DocFX.Plugin.DescriptionGenerator to v1.1.1 * Adjust according to recent CommandExecuted changes See: + https://github.com/RogueException/Discord.Net/commit/f549da50e0cb491350e2116cbb141c82c460a455 + https://github.com/RogueException/Discord.Net/commit/62607490952511ab5fc41965cea10f9879914c95 * Add further documentation for https://github.com/RogueException/Discord.Net/pull/1037 * Add partial documentation for the precondition helper class * Include CHANGELOG.md in docs * Revise post-execution docs * Fix incorrect Optional<T> usage * Indent some sample code and add a comment reminding the user that the post-execution basic sample code is not ideal. * Streamline docs for Attachment + This commit also adds further explanation for why Embeds and Attachments are read-only collections * Add further documentation for MessageActivity and MessageApplication * Add caching-related docs to ISocketMessageChannel * Add missing documentation inheritance for SyncPermissionsAsync * Streamline documentation process This is done by changing the documentation of the implementations required by interfaces to redirect to the interface method instead (e.g., SocketDMChannel#GetMessagesAsync refer to IMessageChannel.GetMessagesAsync within the remarks of the method). * Cleanup https://github.com/RogueException/Discord.Net/commit/92bf8363ca8f71ba181aaeeb57e2fcfd09448257 * Update src/Discord.Net.Core/Entities/Channels/Direction.cs Co-Authored-By: Still34 <341464@gmail.com> * Update src/Discord.Net.Core/Entities/Channels/Direction.cs Co-Authored-By: Still34 <341464@gmail.com> * Update src/Discord.Net.Core/Entities/Channels/GuildChannelProperties.cs Co-Authored-By: Still34 <341464@gmail.com> * Update src/Discord.Net.WebSocket/DiscordSocketConfig.cs Co-Authored-By: Still34 <341464@gmail.com> * Update according to PR suggestions * Reword sentences of deployment article for clarification & remove mention of portability * Fix typos/grammar errors within TextChannelProperties * Add the logo SVG to the page navbar * Implement changing logo image based on theme color using CSS background image * Add a favicon * use the purple logomark instead of white * hack? set the title to navbar svg to read "Discord.Net Docs"
7 years ago
docs: Documentation December Update (#1218) * Fix broken link (#11) * Fix typos and improve wording * Add information for IGuildUser + Add GetPermission sample + Add ModifyAsync remarks * Add information for IGuildChannel + Add ModifyAsync remarks + Add GetOverwritePermissionAsync examples * Add warning for Direction.Around * Fix indentations and references * Move IRole.ModifyAsync sample * Add information for IUser + Add example, remarks for Get(Default)AvatarUrl + Add example, remarks for GetOrCreateDMChannelAsync + Add missing remarks/summary/returns for other properties of the class * Change verbs used in IVoiceState summary/remarks * Add additional explanation for IGuildUser.RoleIds * Change verbs used in IMessage summary/remarks * Clarify IUserMessage Add/RemoveReactionAsync samples * Fix command handler sample typo * Add information for DiscordSocketConfig + Add remarks/example to the class + Add remarks to AlwaysDownloadUsers * Fix documentation for SlowMode * Add additional remarks for Guild/TextChannelProperties * Update DocFx.Plugins.LastModified to v1.2.0 This should drastically improve docfx build time. * Add missing dependencies * Update DocFx.Plugins.LastModified to v1.2.1 Improve performance * Update DocFx.Plugins.LastModified to v1.2.2 * Clarify deployment.md + Rewritten .NET Core deployment strategies for better clarification * Split deployment types into framework-dependent and self-contained * Clarify the benefits of using different types of publishing * Include a sample of how to execute dotnet application with the dotnet command in a TIP dialog for visibility * Update post-execution article and samples + This change is to reflect changes made in https://github.com/RogueException/Discord.Net/pull/1164, where CommandInfo is now passed into the CommandExecuted event as an Optional<T> * Update DocFX.Plugin.DescriptionGenerator to v1.1.1 * Adjust according to recent CommandExecuted changes See: + https://github.com/RogueException/Discord.Net/commit/f549da50e0cb491350e2116cbb141c82c460a455 + https://github.com/RogueException/Discord.Net/commit/62607490952511ab5fc41965cea10f9879914c95 * Add further documentation for https://github.com/RogueException/Discord.Net/pull/1037 * Add partial documentation for the precondition helper class * Include CHANGELOG.md in docs * Revise post-execution docs * Fix incorrect Optional<T> usage * Indent some sample code and add a comment reminding the user that the post-execution basic sample code is not ideal. * Streamline docs for Attachment + This commit also adds further explanation for why Embeds and Attachments are read-only collections * Add further documentation for MessageActivity and MessageApplication * Add caching-related docs to ISocketMessageChannel * Add missing documentation inheritance for SyncPermissionsAsync * Streamline documentation process This is done by changing the documentation of the implementations required by interfaces to redirect to the interface method instead (e.g., SocketDMChannel#GetMessagesAsync refer to IMessageChannel.GetMessagesAsync within the remarks of the method). * Cleanup https://github.com/RogueException/Discord.Net/commit/92bf8363ca8f71ba181aaeeb57e2fcfd09448257 * Update src/Discord.Net.Core/Entities/Channels/Direction.cs Co-Authored-By: Still34 <341464@gmail.com> * Update src/Discord.Net.Core/Entities/Channels/Direction.cs Co-Authored-By: Still34 <341464@gmail.com> * Update src/Discord.Net.Core/Entities/Channels/GuildChannelProperties.cs Co-Authored-By: Still34 <341464@gmail.com> * Update src/Discord.Net.WebSocket/DiscordSocketConfig.cs Co-Authored-By: Still34 <341464@gmail.com> * Update according to PR suggestions * Reword sentences of deployment article for clarification & remove mention of portability * Fix typos/grammar errors within TextChannelProperties * Add the logo SVG to the page navbar * Implement changing logo image based on theme color using CSS background image * Add a favicon * use the purple logomark instead of white * hack? set the title to navbar svg to read "Discord.Net Docs"
7 years ago
docs: Documentation December Update (#1218) * Fix broken link (#11) * Fix typos and improve wording * Add information for IGuildUser + Add GetPermission sample + Add ModifyAsync remarks * Add information for IGuildChannel + Add ModifyAsync remarks + Add GetOverwritePermissionAsync examples * Add warning for Direction.Around * Fix indentations and references * Move IRole.ModifyAsync sample * Add information for IUser + Add example, remarks for Get(Default)AvatarUrl + Add example, remarks for GetOrCreateDMChannelAsync + Add missing remarks/summary/returns for other properties of the class * Change verbs used in IVoiceState summary/remarks * Add additional explanation for IGuildUser.RoleIds * Change verbs used in IMessage summary/remarks * Clarify IUserMessage Add/RemoveReactionAsync samples * Fix command handler sample typo * Add information for DiscordSocketConfig + Add remarks/example to the class + Add remarks to AlwaysDownloadUsers * Fix documentation for SlowMode * Add additional remarks for Guild/TextChannelProperties * Update DocFx.Plugins.LastModified to v1.2.0 This should drastically improve docfx build time. * Add missing dependencies * Update DocFx.Plugins.LastModified to v1.2.1 Improve performance * Update DocFx.Plugins.LastModified to v1.2.2 * Clarify deployment.md + Rewritten .NET Core deployment strategies for better clarification * Split deployment types into framework-dependent and self-contained * Clarify the benefits of using different types of publishing * Include a sample of how to execute dotnet application with the dotnet command in a TIP dialog for visibility * Update post-execution article and samples + This change is to reflect changes made in https://github.com/RogueException/Discord.Net/pull/1164, where CommandInfo is now passed into the CommandExecuted event as an Optional<T> * Update DocFX.Plugin.DescriptionGenerator to v1.1.1 * Adjust according to recent CommandExecuted changes See: + https://github.com/RogueException/Discord.Net/commit/f549da50e0cb491350e2116cbb141c82c460a455 + https://github.com/RogueException/Discord.Net/commit/62607490952511ab5fc41965cea10f9879914c95 * Add further documentation for https://github.com/RogueException/Discord.Net/pull/1037 * Add partial documentation for the precondition helper class * Include CHANGELOG.md in docs * Revise post-execution docs * Fix incorrect Optional<T> usage * Indent some sample code and add a comment reminding the user that the post-execution basic sample code is not ideal. * Streamline docs for Attachment + This commit also adds further explanation for why Embeds and Attachments are read-only collections * Add further documentation for MessageActivity and MessageApplication * Add caching-related docs to ISocketMessageChannel * Add missing documentation inheritance for SyncPermissionsAsync * Streamline documentation process This is done by changing the documentation of the implementations required by interfaces to redirect to the interface method instead (e.g., SocketDMChannel#GetMessagesAsync refer to IMessageChannel.GetMessagesAsync within the remarks of the method). * Cleanup https://github.com/RogueException/Discord.Net/commit/92bf8363ca8f71ba181aaeeb57e2fcfd09448257 * Update src/Discord.Net.Core/Entities/Channels/Direction.cs Co-Authored-By: Still34 <341464@gmail.com> * Update src/Discord.Net.Core/Entities/Channels/Direction.cs Co-Authored-By: Still34 <341464@gmail.com> * Update src/Discord.Net.Core/Entities/Channels/GuildChannelProperties.cs Co-Authored-By: Still34 <341464@gmail.com> * Update src/Discord.Net.WebSocket/DiscordSocketConfig.cs Co-Authored-By: Still34 <341464@gmail.com> * Update according to PR suggestions * Reword sentences of deployment article for clarification & remove mention of portability * Fix typos/grammar errors within TextChannelProperties * Add the logo SVG to the page navbar * Implement changing logo image based on theme color using CSS background image * Add a favicon * use the purple logomark instead of white * hack? set the title to navbar svg to read "Discord.Net Docs"
7 years ago
docs: Documentation December Update (#1218) * Fix broken link (#11) * Fix typos and improve wording * Add information for IGuildUser + Add GetPermission sample + Add ModifyAsync remarks * Add information for IGuildChannel + Add ModifyAsync remarks + Add GetOverwritePermissionAsync examples * Add warning for Direction.Around * Fix indentations and references * Move IRole.ModifyAsync sample * Add information for IUser + Add example, remarks for Get(Default)AvatarUrl + Add example, remarks for GetOrCreateDMChannelAsync + Add missing remarks/summary/returns for other properties of the class * Change verbs used in IVoiceState summary/remarks * Add additional explanation for IGuildUser.RoleIds * Change verbs used in IMessage summary/remarks * Clarify IUserMessage Add/RemoveReactionAsync samples * Fix command handler sample typo * Add information for DiscordSocketConfig + Add remarks/example to the class + Add remarks to AlwaysDownloadUsers * Fix documentation for SlowMode * Add additional remarks for Guild/TextChannelProperties * Update DocFx.Plugins.LastModified to v1.2.0 This should drastically improve docfx build time. * Add missing dependencies * Update DocFx.Plugins.LastModified to v1.2.1 Improve performance * Update DocFx.Plugins.LastModified to v1.2.2 * Clarify deployment.md + Rewritten .NET Core deployment strategies for better clarification * Split deployment types into framework-dependent and self-contained * Clarify the benefits of using different types of publishing * Include a sample of how to execute dotnet application with the dotnet command in a TIP dialog for visibility * Update post-execution article and samples + This change is to reflect changes made in https://github.com/RogueException/Discord.Net/pull/1164, where CommandInfo is now passed into the CommandExecuted event as an Optional<T> * Update DocFX.Plugin.DescriptionGenerator to v1.1.1 * Adjust according to recent CommandExecuted changes See: + https://github.com/RogueException/Discord.Net/commit/f549da50e0cb491350e2116cbb141c82c460a455 + https://github.com/RogueException/Discord.Net/commit/62607490952511ab5fc41965cea10f9879914c95 * Add further documentation for https://github.com/RogueException/Discord.Net/pull/1037 * Add partial documentation for the precondition helper class * Include CHANGELOG.md in docs * Revise post-execution docs * Fix incorrect Optional<T> usage * Indent some sample code and add a comment reminding the user that the post-execution basic sample code is not ideal. * Streamline docs for Attachment + This commit also adds further explanation for why Embeds and Attachments are read-only collections * Add further documentation for MessageActivity and MessageApplication * Add caching-related docs to ISocketMessageChannel * Add missing documentation inheritance for SyncPermissionsAsync * Streamline documentation process This is done by changing the documentation of the implementations required by interfaces to redirect to the interface method instead (e.g., SocketDMChannel#GetMessagesAsync refer to IMessageChannel.GetMessagesAsync within the remarks of the method). * Cleanup https://github.com/RogueException/Discord.Net/commit/92bf8363ca8f71ba181aaeeb57e2fcfd09448257 * Update src/Discord.Net.Core/Entities/Channels/Direction.cs Co-Authored-By: Still34 <341464@gmail.com> * Update src/Discord.Net.Core/Entities/Channels/Direction.cs Co-Authored-By: Still34 <341464@gmail.com> * Update src/Discord.Net.Core/Entities/Channels/GuildChannelProperties.cs Co-Authored-By: Still34 <341464@gmail.com> * Update src/Discord.Net.WebSocket/DiscordSocketConfig.cs Co-Authored-By: Still34 <341464@gmail.com> * Update according to PR suggestions * Reword sentences of deployment article for clarification & remove mention of portability * Fix typos/grammar errors within TextChannelProperties * Add the logo SVG to the page navbar * Implement changing logo image based on theme color using CSS background image * Add a favicon * use the purple logomark instead of white * hack? set the title to navbar svg to read "Discord.Net Docs"
7 years ago
docs: Documentation December Update (#1218) * Fix broken link (#11) * Fix typos and improve wording * Add information for IGuildUser + Add GetPermission sample + Add ModifyAsync remarks * Add information for IGuildChannel + Add ModifyAsync remarks + Add GetOverwritePermissionAsync examples * Add warning for Direction.Around * Fix indentations and references * Move IRole.ModifyAsync sample * Add information for IUser + Add example, remarks for Get(Default)AvatarUrl + Add example, remarks for GetOrCreateDMChannelAsync + Add missing remarks/summary/returns for other properties of the class * Change verbs used in IVoiceState summary/remarks * Add additional explanation for IGuildUser.RoleIds * Change verbs used in IMessage summary/remarks * Clarify IUserMessage Add/RemoveReactionAsync samples * Fix command handler sample typo * Add information for DiscordSocketConfig + Add remarks/example to the class + Add remarks to AlwaysDownloadUsers * Fix documentation for SlowMode * Add additional remarks for Guild/TextChannelProperties * Update DocFx.Plugins.LastModified to v1.2.0 This should drastically improve docfx build time. * Add missing dependencies * Update DocFx.Plugins.LastModified to v1.2.1 Improve performance * Update DocFx.Plugins.LastModified to v1.2.2 * Clarify deployment.md + Rewritten .NET Core deployment strategies for better clarification * Split deployment types into framework-dependent and self-contained * Clarify the benefits of using different types of publishing * Include a sample of how to execute dotnet application with the dotnet command in a TIP dialog for visibility * Update post-execution article and samples + This change is to reflect changes made in https://github.com/RogueException/Discord.Net/pull/1164, where CommandInfo is now passed into the CommandExecuted event as an Optional<T> * Update DocFX.Plugin.DescriptionGenerator to v1.1.1 * Adjust according to recent CommandExecuted changes See: + https://github.com/RogueException/Discord.Net/commit/f549da50e0cb491350e2116cbb141c82c460a455 + https://github.com/RogueException/Discord.Net/commit/62607490952511ab5fc41965cea10f9879914c95 * Add further documentation for https://github.com/RogueException/Discord.Net/pull/1037 * Add partial documentation for the precondition helper class * Include CHANGELOG.md in docs * Revise post-execution docs * Fix incorrect Optional<T> usage * Indent some sample code and add a comment reminding the user that the post-execution basic sample code is not ideal. * Streamline docs for Attachment + This commit also adds further explanation for why Embeds and Attachments are read-only collections * Add further documentation for MessageActivity and MessageApplication * Add caching-related docs to ISocketMessageChannel * Add missing documentation inheritance for SyncPermissionsAsync * Streamline documentation process This is done by changing the documentation of the implementations required by interfaces to redirect to the interface method instead (e.g., SocketDMChannel#GetMessagesAsync refer to IMessageChannel.GetMessagesAsync within the remarks of the method). * Cleanup https://github.com/RogueException/Discord.Net/commit/92bf8363ca8f71ba181aaeeb57e2fcfd09448257 * Update src/Discord.Net.Core/Entities/Channels/Direction.cs Co-Authored-By: Still34 <341464@gmail.com> * Update src/Discord.Net.Core/Entities/Channels/Direction.cs Co-Authored-By: Still34 <341464@gmail.com> * Update src/Discord.Net.Core/Entities/Channels/GuildChannelProperties.cs Co-Authored-By: Still34 <341464@gmail.com> * Update src/Discord.Net.WebSocket/DiscordSocketConfig.cs Co-Authored-By: Still34 <341464@gmail.com> * Update according to PR suggestions * Reword sentences of deployment article for clarification & remove mention of portability * Fix typos/grammar errors within TextChannelProperties * Add the logo SVG to the page navbar * Implement changing logo image based on theme color using CSS background image * Add a favicon * use the purple logomark instead of white * hack? set the title to navbar svg to read "Discord.Net Docs"
7 years ago
docs: Documentation December Update (#1218) * Fix broken link (#11) * Fix typos and improve wording * Add information for IGuildUser + Add GetPermission sample + Add ModifyAsync remarks * Add information for IGuildChannel + Add ModifyAsync remarks + Add GetOverwritePermissionAsync examples * Add warning for Direction.Around * Fix indentations and references * Move IRole.ModifyAsync sample * Add information for IUser + Add example, remarks for Get(Default)AvatarUrl + Add example, remarks for GetOrCreateDMChannelAsync + Add missing remarks/summary/returns for other properties of the class * Change verbs used in IVoiceState summary/remarks * Add additional explanation for IGuildUser.RoleIds * Change verbs used in IMessage summary/remarks * Clarify IUserMessage Add/RemoveReactionAsync samples * Fix command handler sample typo * Add information for DiscordSocketConfig + Add remarks/example to the class + Add remarks to AlwaysDownloadUsers * Fix documentation for SlowMode * Add additional remarks for Guild/TextChannelProperties * Update DocFx.Plugins.LastModified to v1.2.0 This should drastically improve docfx build time. * Add missing dependencies * Update DocFx.Plugins.LastModified to v1.2.1 Improve performance * Update DocFx.Plugins.LastModified to v1.2.2 * Clarify deployment.md + Rewritten .NET Core deployment strategies for better clarification * Split deployment types into framework-dependent and self-contained * Clarify the benefits of using different types of publishing * Include a sample of how to execute dotnet application with the dotnet command in a TIP dialog for visibility * Update post-execution article and samples + This change is to reflect changes made in https://github.com/RogueException/Discord.Net/pull/1164, where CommandInfo is now passed into the CommandExecuted event as an Optional<T> * Update DocFX.Plugin.DescriptionGenerator to v1.1.1 * Adjust according to recent CommandExecuted changes See: + https://github.com/RogueException/Discord.Net/commit/f549da50e0cb491350e2116cbb141c82c460a455 + https://github.com/RogueException/Discord.Net/commit/62607490952511ab5fc41965cea10f9879914c95 * Add further documentation for https://github.com/RogueException/Discord.Net/pull/1037 * Add partial documentation for the precondition helper class * Include CHANGELOG.md in docs * Revise post-execution docs * Fix incorrect Optional<T> usage * Indent some sample code and add a comment reminding the user that the post-execution basic sample code is not ideal. * Streamline docs for Attachment + This commit also adds further explanation for why Embeds and Attachments are read-only collections * Add further documentation for MessageActivity and MessageApplication * Add caching-related docs to ISocketMessageChannel * Add missing documentation inheritance for SyncPermissionsAsync * Streamline documentation process This is done by changing the documentation of the implementations required by interfaces to redirect to the interface method instead (e.g., SocketDMChannel#GetMessagesAsync refer to IMessageChannel.GetMessagesAsync within the remarks of the method). * Cleanup https://github.com/RogueException/Discord.Net/commit/92bf8363ca8f71ba181aaeeb57e2fcfd09448257 * Update src/Discord.Net.Core/Entities/Channels/Direction.cs Co-Authored-By: Still34 <341464@gmail.com> * Update src/Discord.Net.Core/Entities/Channels/Direction.cs Co-Authored-By: Still34 <341464@gmail.com> * Update src/Discord.Net.Core/Entities/Channels/GuildChannelProperties.cs Co-Authored-By: Still34 <341464@gmail.com> * Update src/Discord.Net.WebSocket/DiscordSocketConfig.cs Co-Authored-By: Still34 <341464@gmail.com> * Update according to PR suggestions * Reword sentences of deployment article for clarification & remove mention of portability * Fix typos/grammar errors within TextChannelProperties * Add the logo SVG to the page navbar * Implement changing logo image based on theme color using CSS background image * Add a favicon * use the purple logomark instead of white * hack? set the title to navbar svg to read "Discord.Net Docs"
7 years ago
docs: Documentation December Update (#1218) * Fix broken link (#11) * Fix typos and improve wording * Add information for IGuildUser + Add GetPermission sample + Add ModifyAsync remarks * Add information for IGuildChannel + Add ModifyAsync remarks + Add GetOverwritePermissionAsync examples * Add warning for Direction.Around * Fix indentations and references * Move IRole.ModifyAsync sample * Add information for IUser + Add example, remarks for Get(Default)AvatarUrl + Add example, remarks for GetOrCreateDMChannelAsync + Add missing remarks/summary/returns for other properties of the class * Change verbs used in IVoiceState summary/remarks * Add additional explanation for IGuildUser.RoleIds * Change verbs used in IMessage summary/remarks * Clarify IUserMessage Add/RemoveReactionAsync samples * Fix command handler sample typo * Add information for DiscordSocketConfig + Add remarks/example to the class + Add remarks to AlwaysDownloadUsers * Fix documentation for SlowMode * Add additional remarks for Guild/TextChannelProperties * Update DocFx.Plugins.LastModified to v1.2.0 This should drastically improve docfx build time. * Add missing dependencies * Update DocFx.Plugins.LastModified to v1.2.1 Improve performance * Update DocFx.Plugins.LastModified to v1.2.2 * Clarify deployment.md + Rewritten .NET Core deployment strategies for better clarification * Split deployment types into framework-dependent and self-contained * Clarify the benefits of using different types of publishing * Include a sample of how to execute dotnet application with the dotnet command in a TIP dialog for visibility * Update post-execution article and samples + This change is to reflect changes made in https://github.com/RogueException/Discord.Net/pull/1164, where CommandInfo is now passed into the CommandExecuted event as an Optional<T> * Update DocFX.Plugin.DescriptionGenerator to v1.1.1 * Adjust according to recent CommandExecuted changes See: + https://github.com/RogueException/Discord.Net/commit/f549da50e0cb491350e2116cbb141c82c460a455 + https://github.com/RogueException/Discord.Net/commit/62607490952511ab5fc41965cea10f9879914c95 * Add further documentation for https://github.com/RogueException/Discord.Net/pull/1037 * Add partial documentation for the precondition helper class * Include CHANGELOG.md in docs * Revise post-execution docs * Fix incorrect Optional<T> usage * Indent some sample code and add a comment reminding the user that the post-execution basic sample code is not ideal. * Streamline docs for Attachment + This commit also adds further explanation for why Embeds and Attachments are read-only collections * Add further documentation for MessageActivity and MessageApplication * Add caching-related docs to ISocketMessageChannel * Add missing documentation inheritance for SyncPermissionsAsync * Streamline documentation process This is done by changing the documentation of the implementations required by interfaces to redirect to the interface method instead (e.g., SocketDMChannel#GetMessagesAsync refer to IMessageChannel.GetMessagesAsync within the remarks of the method). * Cleanup https://github.com/RogueException/Discord.Net/commit/92bf8363ca8f71ba181aaeeb57e2fcfd09448257 * Update src/Discord.Net.Core/Entities/Channels/Direction.cs Co-Authored-By: Still34 <341464@gmail.com> * Update src/Discord.Net.Core/Entities/Channels/Direction.cs Co-Authored-By: Still34 <341464@gmail.com> * Update src/Discord.Net.Core/Entities/Channels/GuildChannelProperties.cs Co-Authored-By: Still34 <341464@gmail.com> * Update src/Discord.Net.WebSocket/DiscordSocketConfig.cs Co-Authored-By: Still34 <341464@gmail.com> * Update according to PR suggestions * Reword sentences of deployment article for clarification & remove mention of portability * Fix typos/grammar errors within TextChannelProperties * Add the logo SVG to the page navbar * Implement changing logo image based on theme color using CSS background image * Add a favicon * use the purple logomark instead of white * hack? set the title to navbar svg to read "Discord.Net Docs"
7 years ago
docs: Documentation December Update (#1218) * Fix broken link (#11) * Fix typos and improve wording * Add information for IGuildUser + Add GetPermission sample + Add ModifyAsync remarks * Add information for IGuildChannel + Add ModifyAsync remarks + Add GetOverwritePermissionAsync examples * Add warning for Direction.Around * Fix indentations and references * Move IRole.ModifyAsync sample * Add information for IUser + Add example, remarks for Get(Default)AvatarUrl + Add example, remarks for GetOrCreateDMChannelAsync + Add missing remarks/summary/returns for other properties of the class * Change verbs used in IVoiceState summary/remarks * Add additional explanation for IGuildUser.RoleIds * Change verbs used in IMessage summary/remarks * Clarify IUserMessage Add/RemoveReactionAsync samples * Fix command handler sample typo * Add information for DiscordSocketConfig + Add remarks/example to the class + Add remarks to AlwaysDownloadUsers * Fix documentation for SlowMode * Add additional remarks for Guild/TextChannelProperties * Update DocFx.Plugins.LastModified to v1.2.0 This should drastically improve docfx build time. * Add missing dependencies * Update DocFx.Plugins.LastModified to v1.2.1 Improve performance * Update DocFx.Plugins.LastModified to v1.2.2 * Clarify deployment.md + Rewritten .NET Core deployment strategies for better clarification * Split deployment types into framework-dependent and self-contained * Clarify the benefits of using different types of publishing * Include a sample of how to execute dotnet application with the dotnet command in a TIP dialog for visibility * Update post-execution article and samples + This change is to reflect changes made in https://github.com/RogueException/Discord.Net/pull/1164, where CommandInfo is now passed into the CommandExecuted event as an Optional<T> * Update DocFX.Plugin.DescriptionGenerator to v1.1.1 * Adjust according to recent CommandExecuted changes See: + https://github.com/RogueException/Discord.Net/commit/f549da50e0cb491350e2116cbb141c82c460a455 + https://github.com/RogueException/Discord.Net/commit/62607490952511ab5fc41965cea10f9879914c95 * Add further documentation for https://github.com/RogueException/Discord.Net/pull/1037 * Add partial documentation for the precondition helper class * Include CHANGELOG.md in docs * Revise post-execution docs * Fix incorrect Optional<T> usage * Indent some sample code and add a comment reminding the user that the post-execution basic sample code is not ideal. * Streamline docs for Attachment + This commit also adds further explanation for why Embeds and Attachments are read-only collections * Add further documentation for MessageActivity and MessageApplication * Add caching-related docs to ISocketMessageChannel * Add missing documentation inheritance for SyncPermissionsAsync * Streamline documentation process This is done by changing the documentation of the implementations required by interfaces to redirect to the interface method instead (e.g., SocketDMChannel#GetMessagesAsync refer to IMessageChannel.GetMessagesAsync within the remarks of the method). * Cleanup https://github.com/RogueException/Discord.Net/commit/92bf8363ca8f71ba181aaeeb57e2fcfd09448257 * Update src/Discord.Net.Core/Entities/Channels/Direction.cs Co-Authored-By: Still34 <341464@gmail.com> * Update src/Discord.Net.Core/Entities/Channels/Direction.cs Co-Authored-By: Still34 <341464@gmail.com> * Update src/Discord.Net.Core/Entities/Channels/GuildChannelProperties.cs Co-Authored-By: Still34 <341464@gmail.com> * Update src/Discord.Net.WebSocket/DiscordSocketConfig.cs Co-Authored-By: Still34 <341464@gmail.com> * Update according to PR suggestions * Reword sentences of deployment article for clarification & remove mention of portability * Fix typos/grammar errors within TextChannelProperties * Add the logo SVG to the page navbar * Implement changing logo image based on theme color using CSS background image * Add a favicon * use the purple logomark instead of white * hack? set the title to navbar svg to read "Discord.Net Docs"
7 years ago
docs: Documentation December Update (#1218) * Fix broken link (#11) * Fix typos and improve wording * Add information for IGuildUser + Add GetPermission sample + Add ModifyAsync remarks * Add information for IGuildChannel + Add ModifyAsync remarks + Add GetOverwritePermissionAsync examples * Add warning for Direction.Around * Fix indentations and references * Move IRole.ModifyAsync sample * Add information for IUser + Add example, remarks for Get(Default)AvatarUrl + Add example, remarks for GetOrCreateDMChannelAsync + Add missing remarks/summary/returns for other properties of the class * Change verbs used in IVoiceState summary/remarks * Add additional explanation for IGuildUser.RoleIds * Change verbs used in IMessage summary/remarks * Clarify IUserMessage Add/RemoveReactionAsync samples * Fix command handler sample typo * Add information for DiscordSocketConfig + Add remarks/example to the class + Add remarks to AlwaysDownloadUsers * Fix documentation for SlowMode * Add additional remarks for Guild/TextChannelProperties * Update DocFx.Plugins.LastModified to v1.2.0 This should drastically improve docfx build time. * Add missing dependencies * Update DocFx.Plugins.LastModified to v1.2.1 Improve performance * Update DocFx.Plugins.LastModified to v1.2.2 * Clarify deployment.md + Rewritten .NET Core deployment strategies for better clarification * Split deployment types into framework-dependent and self-contained * Clarify the benefits of using different types of publishing * Include a sample of how to execute dotnet application with the dotnet command in a TIP dialog for visibility * Update post-execution article and samples + This change is to reflect changes made in https://github.com/RogueException/Discord.Net/pull/1164, where CommandInfo is now passed into the CommandExecuted event as an Optional<T> * Update DocFX.Plugin.DescriptionGenerator to v1.1.1 * Adjust according to recent CommandExecuted changes See: + https://github.com/RogueException/Discord.Net/commit/f549da50e0cb491350e2116cbb141c82c460a455 + https://github.com/RogueException/Discord.Net/commit/62607490952511ab5fc41965cea10f9879914c95 * Add further documentation for https://github.com/RogueException/Discord.Net/pull/1037 * Add partial documentation for the precondition helper class * Include CHANGELOG.md in docs * Revise post-execution docs * Fix incorrect Optional<T> usage * Indent some sample code and add a comment reminding the user that the post-execution basic sample code is not ideal. * Streamline docs for Attachment + This commit also adds further explanation for why Embeds and Attachments are read-only collections * Add further documentation for MessageActivity and MessageApplication * Add caching-related docs to ISocketMessageChannel * Add missing documentation inheritance for SyncPermissionsAsync * Streamline documentation process This is done by changing the documentation of the implementations required by interfaces to redirect to the interface method instead (e.g., SocketDMChannel#GetMessagesAsync refer to IMessageChannel.GetMessagesAsync within the remarks of the method). * Cleanup https://github.com/RogueException/Discord.Net/commit/92bf8363ca8f71ba181aaeeb57e2fcfd09448257 * Update src/Discord.Net.Core/Entities/Channels/Direction.cs Co-Authored-By: Still34 <341464@gmail.com> * Update src/Discord.Net.Core/Entities/Channels/Direction.cs Co-Authored-By: Still34 <341464@gmail.com> * Update src/Discord.Net.Core/Entities/Channels/GuildChannelProperties.cs Co-Authored-By: Still34 <341464@gmail.com> * Update src/Discord.Net.WebSocket/DiscordSocketConfig.cs Co-Authored-By: Still34 <341464@gmail.com> * Update according to PR suggestions * Reword sentences of deployment article for clarification & remove mention of portability * Fix typos/grammar errors within TextChannelProperties * Add the logo SVG to the page navbar * Implement changing logo image based on theme color using CSS background image * Add a favicon * use the purple logomark instead of white * hack? set the title to navbar svg to read "Discord.Net Docs"
7 years ago
Documentation Overhaul (#1161) * Add XML docs * Clean up style switcher * Squash commits on branch docs/faq-n-patches * Fix broken theme selector * Add local image embed instruction * Add a bunch of XML docs * Add a bunch of XML docs * Fix broken search + DocFX by default ships with an older version of jQuery, switching to a newer version confuses parts of the DocFX Javascript. * Minor fixes for CONTRIBUTING.md and README.md * Clean up filterConfig.yml + New config exposes Discord.Net namespace since it has several common public exceptions that may be helpful to users * Add XML docs * Read token from Environment Variable instead of hardcode * Add XMLDocs * Compress some assets & add OAuth2 URL generator * Fix sample link & add missing pictures * Add tag examples * Fix embed docs consistency * Add details regarding userbot support * Add XML Docs * Add XML Docs * Add XML Docs * Minor fixes in documentations + Fix unescaped '<' + Fix typo * Fix seealso for preconditions and add missing descriptions * Add missing exceptions * Document exposed TypeReaders * Fix letter-casing for files * Add 'last modified' plugin Source: https://github.com/Still34/DocFx.Plugin.LastModified Licensed under MIT License * XML Docs * Fix minor consistencies & redundant impl * Add properties examples to overwrite * Fix missing Username prop * Add warning for bulk-delete endpoint * Replace note block * Add BaseSocketClient docs * Add XML docs * Replace langword null to code block null instead - Because DocFX sucks at rendering langword * Replace all langword placements with code block * Add more IGuild docs * Add details to SpotifyGame * Initial proofread of the articles * Add explanation for RunMode * Add event docs - MessageReceived - ChannelUpdated/Destroyed/Created * Fix light theme link color * Fix xml docs error * Add partial documentation for audit log impl * Add documentation for some REST-based objects * Add partial documentation for audit log objects * Add more XML comments to quotation mark alias map stuff, including an example * Add reference to CommandServiceConfig from the util docs' * Add explanation that if " is removed then it wont work * Fix missing service provider in example * Add documentation for new INestedChannel * Add documentation * Add documentation for new API version & few events * Revise guide paragraphs/samples + Fix various formatting. + Provide a more detailed walkthrough for dependency injection. + Add C# note at intro. * Fix typos & formatting * Improve group module example * Small amount to see if I'm doing it right * Remove/cleanup redundant variables * Fix EnterTypingState impl for doc inheritance * Fix Test to resolve changes made in 15b58e * Improve precondition documentation + Add precondition usage sample + Add precondition group usage sample + Move precondition samples to its own sample folder * Move samples to individual folders * Clarify token source * Cleanup styling of README.md for docs * Replace InvalidPathChars for NS1.3 * InvalidPathChars does not exist in NS1.3; replaced with GetInvalidPathChars instead. * Add a missing change for 2c7cc738 * Update LastModified to v1.1.0 & add license * Rewrite installation page for Core 2.1 * Fix anchor link * Bump post-processor to v1.1.1 * Add fixes to partial file & add license * Moved theme-switcher code to scripts partial file + Add author's MIT license to featherlight javascript * Remove unused bootstrap plugin * Bump LastModified plugin * Changed the path from 'lastmodified' to 'last-modified' for consistency * Cleanup README & Contribution guide * Changes to last pr * Fix GetCategoryAsync docs * Proofread and cleanup articles * Change passive voice in "Get Started" to active * Fix improper preposition in Commands Introduction page * Fix minor grammar mistakes in "Your First Bot" (future tense -> present tense/subjunctive mood -> indicative mood/proper noun casing/incorrect noun/add missing article) * Fix minor grammar mistakes in "Installation" (missing article) * no hablo ingles * Try try try again * I'm sure you're having as much fun as I am * Cleanup TOC & fix titles * Improve styling + Change title font to Noto Sans + Add materialized design for commit message box * Add DescriptionGenerator plugin * Add nightly section for clarification * Fix typos in Nightlies & Post-execution * Bump DescriptionGenerator to v1.1.0 + This build adds the functionality of generating managed references' summary into the description tag. * Initial emoji article draft * Add 'additional information' section for emoji article * Add cosmetic changes to the master css * Alter info box color + Add transition to article content * Add clarification in the emoji article * Emphasize that normal emoji string will not translate to its Unicode representation. * Clean up or add some of the samples featured in the article. + Add emoji/emote declaration section for clarification. + Add WebSocket emote sample. - Remove inconsistent styling ('wacky memes' proves to be too out of place). * Improve readability for nightlies article * Move 'Bundled Preconditions' section * Bump LastModified to fix UTC DateTime parsing * Add langwordMapping.yml * Add XML docs * Add VSC workspace rule * The root workspace limits the ruler to 120 characters for member documentations and excludes folders such as 'samples' and 'docs'. * The docs workspace limits the ruler to 70 characters for standard conceptual article to comply with documentation's CONTRIBUTING.md rule, and excludes temprorary folders created by DocFX. * Update CONTRIBUTING.md * Add documentation style rule * Fix styling of several member documentation * Fix ' />' caused by Agent Smith oddities * Fix styling to be more specific about the mention of IDs * Fix exception summary to comply with official Microsoft Docs style * References https://docs.microsoft.com/en-us/dotnet/api/system.argumentnullexception?view=netframework-4.7.2 https://docs.microsoft.com/en-us/dotnet/api/system.platformnotsupportedexception?view=netframework-4.7.2 https://docs.microsoft.com/en-us/dotnet/api/system.badimageformatexception?view=netframework-4.7.2 * Add XML documentations * Shift color return docs * Fix minor docs * Added documentation for SocketDMChannel, SocketGuildChannel, and SocketTextChannel * Add XML docs * Corrections to SocketGuildChannel * Corrections to SocketTextChannel * Corrections to SocketDMChannel * Swapped out 'id' for 'snowflake identifier * Swapped out 'id' for 'snowflake identifier' * SocketDMChannel amendments * SocketGuildChannel amendments * SocketTextChannel amendments * Add XML docs & patch return types + Starting from this commit, all return types for tasks will use style similar to most documentations featured on docs.microsoft.com References: https://docs.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.dbcontext.-ctor?view=efcore-2.1 https://docs.microsoft.com/en-us/dotnet/api/system.io.filestream.readasync?view=netcore-2.1 https://docs.microsoft.com/en-us/dotnet/api/system.io.textwriter.writelineasync?view=netcore-2.1#System_IO_TextWriter_WriteLineAsync_System_Char___ And many more other asynchronous method documentations featured in the latest BCL. * Added documentation for many audit log data types, fixed vowel indefinite articles * Change audit log data types to start with 'Contains' (verb) instead of an article * Fix some documentation issues and document some more audit log data types * Fix English posession * Add XML doc * Documented two more types * Documented RoleCreateAuditLogData * Document remaining audit log data types * Added RestDMChannel documentation * Added RestGuildChannel documentation * Added RestTextChannel documentation * Added RestVoiceChannel documentation * Added RestUser documentation * Added RestRole documentation * Added RestMessage documentation * Slightly better wording * Contains -> Contains a piece of (describe article) * [EN] Present perf. -> past perf. * Add XML docs * Fix arrow alignment * Clarify supported nullable type * Fixed a typo in ISnowflakeEntity * Added RestUser Documentation * Added RestInvite documentation * Add XML docs & minor optimizations * Minor optimization for doc rendering * Rollback font optimization changes * Amendments to RestUser * Added SocketDMChannel documentation * Added RestDMChannel documentation * Added RestGuild documentation * Adjustment to SocketDMChannel * Added minimal descriptions from the API documentation for Integration types * Added obsolete mention to the ReadMessages flag. * Added remarks about 2FA requirement for guild permissions * Added xmldoc for GuildPermission methods * Added xml doc for ToAllowList and ToDenyList * Added specification of how the bits of the color raw value are packed * Added discord API documentation to IConnection interface * I can spell :^) * Fix whitespace in ChannelPermission * fix spacing of values in guildpermission * Made changes to get field descriptions from feedback, added returns tag to IConnection * Added property get standard for IntegrationAccount * Added property get pattern to xml docs and identical returns tag. * Change all color class references to struct ...because it isn't a class. * Add XML docs * Rewrote the returns tags in IGuildIntegration, removed the ones I was unsure about. * Rewrote the rest of the returns tags * Amendments * Cleanup doc for c1d78189 * Added types to <returns> tags where missing * Added second sample for adding reactions * Added some class summaries * Missed a period * Amendments * restored the removed line break * Removed unnecessary see tag * Use consistent quotation marks around subscribers, the name for these users are dependant on the source of where they are integrated from (youtube or twitch), so we should not use a name that is specific to one platform * Add <remarks> tag to the IGuildIntegration xmldocs * Fix grammar issue * Update DescriptionGenerator * Cleanup of https://github.com/Still34/Discord.Net/pull/8 * Cleanup previous PR * Fix for misleading behaviour in the emoji guide + Original lines stated that sending a emoji wrapped in colon will not be parsed, but that was incorrect; replaced with reactions instead of sending messages as the example * Add strings for dictionary in DotSettings * Add XML docs * Fix lots of typos in comments + Geez, I didn't know there were so many. * Add XML docs & rewrite GetMessagesAsync docs This commit rewrites the remarks section of GetMessagesAsync, as well as adding examples to several methods. * Update 'Your First Bot' + This commit reflects the new changes made to the Discord Application Developer Portal after its major update * Initial optimization for DocFX render & add missing files * Add examples in message methods * Cleanup https://github.com/RogueException/Discord.Net/pull/1128 * Fix first bot note * Cleanup FAQ structure * Add XML docs * Update docfx plugins * Fix navbar collapsing issue * Fix broken xref * Cleanup FAQ section + Add introductory paragraphs to each FAQ section. + Add 'missing dependency' entry to commands FAQ. * Split commands FAQ to 'General' and 'DI' sections. * Cleanup https://github.com/RogueException/Discord.Net/pull/1139 * Fix missing namespace * Add missing highlighting css for the light theme * Add additional clarification for installing packages * Add indentation to example for clarity * Cleanup several articles to be more human-friendly and easier to read * Remove RPC-related notes * Cleanup slow-mode-related documentation strings * Add an additional note about cross-guild emote usage * Add CreateTextChannel sample * Add XMLDocs
7 years ago
Documentation Overhaul (#1161) * Add XML docs * Clean up style switcher * Squash commits on branch docs/faq-n-patches * Fix broken theme selector * Add local image embed instruction * Add a bunch of XML docs * Add a bunch of XML docs * Fix broken search + DocFX by default ships with an older version of jQuery, switching to a newer version confuses parts of the DocFX Javascript. * Minor fixes for CONTRIBUTING.md and README.md * Clean up filterConfig.yml + New config exposes Discord.Net namespace since it has several common public exceptions that may be helpful to users * Add XML docs * Read token from Environment Variable instead of hardcode * Add XMLDocs * Compress some assets & add OAuth2 URL generator * Fix sample link & add missing pictures * Add tag examples * Fix embed docs consistency * Add details regarding userbot support * Add XML Docs * Add XML Docs * Add XML Docs * Minor fixes in documentations + Fix unescaped '<' + Fix typo * Fix seealso for preconditions and add missing descriptions * Add missing exceptions * Document exposed TypeReaders * Fix letter-casing for files * Add 'last modified' plugin Source: https://github.com/Still34/DocFx.Plugin.LastModified Licensed under MIT License * XML Docs * Fix minor consistencies & redundant impl * Add properties examples to overwrite * Fix missing Username prop * Add warning for bulk-delete endpoint * Replace note block * Add BaseSocketClient docs * Add XML docs * Replace langword null to code block null instead - Because DocFX sucks at rendering langword * Replace all langword placements with code block * Add more IGuild docs * Add details to SpotifyGame * Initial proofread of the articles * Add explanation for RunMode * Add event docs - MessageReceived - ChannelUpdated/Destroyed/Created * Fix light theme link color * Fix xml docs error * Add partial documentation for audit log impl * Add documentation for some REST-based objects * Add partial documentation for audit log objects * Add more XML comments to quotation mark alias map stuff, including an example * Add reference to CommandServiceConfig from the util docs' * Add explanation that if " is removed then it wont work * Fix missing service provider in example * Add documentation for new INestedChannel * Add documentation * Add documentation for new API version & few events * Revise guide paragraphs/samples + Fix various formatting. + Provide a more detailed walkthrough for dependency injection. + Add C# note at intro. * Fix typos & formatting * Improve group module example * Small amount to see if I'm doing it right * Remove/cleanup redundant variables * Fix EnterTypingState impl for doc inheritance * Fix Test to resolve changes made in 15b58e * Improve precondition documentation + Add precondition usage sample + Add precondition group usage sample + Move precondition samples to its own sample folder * Move samples to individual folders * Clarify token source * Cleanup styling of README.md for docs * Replace InvalidPathChars for NS1.3 * InvalidPathChars does not exist in NS1.3; replaced with GetInvalidPathChars instead. * Add a missing change for 2c7cc738 * Update LastModified to v1.1.0 & add license * Rewrite installation page for Core 2.1 * Fix anchor link * Bump post-processor to v1.1.1 * Add fixes to partial file & add license * Moved theme-switcher code to scripts partial file + Add author's MIT license to featherlight javascript * Remove unused bootstrap plugin * Bump LastModified plugin * Changed the path from 'lastmodified' to 'last-modified' for consistency * Cleanup README & Contribution guide * Changes to last pr * Fix GetCategoryAsync docs * Proofread and cleanup articles * Change passive voice in "Get Started" to active * Fix improper preposition in Commands Introduction page * Fix minor grammar mistakes in "Your First Bot" (future tense -> present tense/subjunctive mood -> indicative mood/proper noun casing/incorrect noun/add missing article) * Fix minor grammar mistakes in "Installation" (missing article) * no hablo ingles * Try try try again * I'm sure you're having as much fun as I am * Cleanup TOC & fix titles * Improve styling + Change title font to Noto Sans + Add materialized design for commit message box * Add DescriptionGenerator plugin * Add nightly section for clarification * Fix typos in Nightlies & Post-execution * Bump DescriptionGenerator to v1.1.0 + This build adds the functionality of generating managed references' summary into the description tag. * Initial emoji article draft * Add 'additional information' section for emoji article * Add cosmetic changes to the master css * Alter info box color + Add transition to article content * Add clarification in the emoji article * Emphasize that normal emoji string will not translate to its Unicode representation. * Clean up or add some of the samples featured in the article. + Add emoji/emote declaration section for clarification. + Add WebSocket emote sample. - Remove inconsistent styling ('wacky memes' proves to be too out of place). * Improve readability for nightlies article * Move 'Bundled Preconditions' section * Bump LastModified to fix UTC DateTime parsing * Add langwordMapping.yml * Add XML docs * Add VSC workspace rule * The root workspace limits the ruler to 120 characters for member documentations and excludes folders such as 'samples' and 'docs'. * The docs workspace limits the ruler to 70 characters for standard conceptual article to comply with documentation's CONTRIBUTING.md rule, and excludes temprorary folders created by DocFX. * Update CONTRIBUTING.md * Add documentation style rule * Fix styling of several member documentation * Fix ' />' caused by Agent Smith oddities * Fix styling to be more specific about the mention of IDs * Fix exception summary to comply with official Microsoft Docs style * References https://docs.microsoft.com/en-us/dotnet/api/system.argumentnullexception?view=netframework-4.7.2 https://docs.microsoft.com/en-us/dotnet/api/system.platformnotsupportedexception?view=netframework-4.7.2 https://docs.microsoft.com/en-us/dotnet/api/system.badimageformatexception?view=netframework-4.7.2 * Add XML documentations * Shift color return docs * Fix minor docs * Added documentation for SocketDMChannel, SocketGuildChannel, and SocketTextChannel * Add XML docs * Corrections to SocketGuildChannel * Corrections to SocketTextChannel * Corrections to SocketDMChannel * Swapped out 'id' for 'snowflake identifier * Swapped out 'id' for 'snowflake identifier' * SocketDMChannel amendments * SocketGuildChannel amendments * SocketTextChannel amendments * Add XML docs & patch return types + Starting from this commit, all return types for tasks will use style similar to most documentations featured on docs.microsoft.com References: https://docs.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.dbcontext.-ctor?view=efcore-2.1 https://docs.microsoft.com/en-us/dotnet/api/system.io.filestream.readasync?view=netcore-2.1 https://docs.microsoft.com/en-us/dotnet/api/system.io.textwriter.writelineasync?view=netcore-2.1#System_IO_TextWriter_WriteLineAsync_System_Char___ And many more other asynchronous method documentations featured in the latest BCL. * Added documentation for many audit log data types, fixed vowel indefinite articles * Change audit log data types to start with 'Contains' (verb) instead of an article * Fix some documentation issues and document some more audit log data types * Fix English posession * Add XML doc * Documented two more types * Documented RoleCreateAuditLogData * Document remaining audit log data types * Added RestDMChannel documentation * Added RestGuildChannel documentation * Added RestTextChannel documentation * Added RestVoiceChannel documentation * Added RestUser documentation * Added RestRole documentation * Added RestMessage documentation * Slightly better wording * Contains -> Contains a piece of (describe article) * [EN] Present perf. -> past perf. * Add XML docs * Fix arrow alignment * Clarify supported nullable type * Fixed a typo in ISnowflakeEntity * Added RestUser Documentation * Added RestInvite documentation * Add XML docs & minor optimizations * Minor optimization for doc rendering * Rollback font optimization changes * Amendments to RestUser * Added SocketDMChannel documentation * Added RestDMChannel documentation * Added RestGuild documentation * Adjustment to SocketDMChannel * Added minimal descriptions from the API documentation for Integration types * Added obsolete mention to the ReadMessages flag. * Added remarks about 2FA requirement for guild permissions * Added xmldoc for GuildPermission methods * Added xml doc for ToAllowList and ToDenyList * Added specification of how the bits of the color raw value are packed * Added discord API documentation to IConnection interface * I can spell :^) * Fix whitespace in ChannelPermission * fix spacing of values in guildpermission * Made changes to get field descriptions from feedback, added returns tag to IConnection * Added property get standard for IntegrationAccount * Added property get pattern to xml docs and identical returns tag. * Change all color class references to struct ...because it isn't a class. * Add XML docs * Rewrote the returns tags in IGuildIntegration, removed the ones I was unsure about. * Rewrote the rest of the returns tags * Amendments * Cleanup doc for c1d78189 * Added types to <returns> tags where missing * Added second sample for adding reactions * Added some class summaries * Missed a period * Amendments * restored the removed line break * Removed unnecessary see tag * Use consistent quotation marks around subscribers, the name for these users are dependant on the source of where they are integrated from (youtube or twitch), so we should not use a name that is specific to one platform * Add <remarks> tag to the IGuildIntegration xmldocs * Fix grammar issue * Update DescriptionGenerator * Cleanup of https://github.com/Still34/Discord.Net/pull/8 * Cleanup previous PR * Fix for misleading behaviour in the emoji guide + Original lines stated that sending a emoji wrapped in colon will not be parsed, but that was incorrect; replaced with reactions instead of sending messages as the example * Add strings for dictionary in DotSettings * Add XML docs * Fix lots of typos in comments + Geez, I didn't know there were so many. * Add XML docs & rewrite GetMessagesAsync docs This commit rewrites the remarks section of GetMessagesAsync, as well as adding examples to several methods. * Update 'Your First Bot' + This commit reflects the new changes made to the Discord Application Developer Portal after its major update * Initial optimization for DocFX render & add missing files * Add examples in message methods * Cleanup https://github.com/RogueException/Discord.Net/pull/1128 * Fix first bot note * Cleanup FAQ structure * Add XML docs * Update docfx plugins * Fix navbar collapsing issue * Fix broken xref * Cleanup FAQ section + Add introductory paragraphs to each FAQ section. + Add 'missing dependency' entry to commands FAQ. * Split commands FAQ to 'General' and 'DI' sections. * Cleanup https://github.com/RogueException/Discord.Net/pull/1139 * Fix missing namespace * Add missing highlighting css for the light theme * Add additional clarification for installing packages * Add indentation to example for clarity * Cleanup several articles to be more human-friendly and easier to read * Remove RPC-related notes * Cleanup slow-mode-related documentation strings * Add an additional note about cross-guild emote usage * Add CreateTextChannel sample * Add XMLDocs
7 years ago
Documentation Overhaul (#1161) * Add XML docs * Clean up style switcher * Squash commits on branch docs/faq-n-patches * Fix broken theme selector * Add local image embed instruction * Add a bunch of XML docs * Add a bunch of XML docs * Fix broken search + DocFX by default ships with an older version of jQuery, switching to a newer version confuses parts of the DocFX Javascript. * Minor fixes for CONTRIBUTING.md and README.md * Clean up filterConfig.yml + New config exposes Discord.Net namespace since it has several common public exceptions that may be helpful to users * Add XML docs * Read token from Environment Variable instead of hardcode * Add XMLDocs * Compress some assets & add OAuth2 URL generator * Fix sample link & add missing pictures * Add tag examples * Fix embed docs consistency * Add details regarding userbot support * Add XML Docs * Add XML Docs * Add XML Docs * Minor fixes in documentations + Fix unescaped '<' + Fix typo * Fix seealso for preconditions and add missing descriptions * Add missing exceptions * Document exposed TypeReaders * Fix letter-casing for files * Add 'last modified' plugin Source: https://github.com/Still34/DocFx.Plugin.LastModified Licensed under MIT License * XML Docs * Fix minor consistencies & redundant impl * Add properties examples to overwrite * Fix missing Username prop * Add warning for bulk-delete endpoint * Replace note block * Add BaseSocketClient docs * Add XML docs * Replace langword null to code block null instead - Because DocFX sucks at rendering langword * Replace all langword placements with code block * Add more IGuild docs * Add details to SpotifyGame * Initial proofread of the articles * Add explanation for RunMode * Add event docs - MessageReceived - ChannelUpdated/Destroyed/Created * Fix light theme link color * Fix xml docs error * Add partial documentation for audit log impl * Add documentation for some REST-based objects * Add partial documentation for audit log objects * Add more XML comments to quotation mark alias map stuff, including an example * Add reference to CommandServiceConfig from the util docs' * Add explanation that if " is removed then it wont work * Fix missing service provider in example * Add documentation for new INestedChannel * Add documentation * Add documentation for new API version & few events * Revise guide paragraphs/samples + Fix various formatting. + Provide a more detailed walkthrough for dependency injection. + Add C# note at intro. * Fix typos & formatting * Improve group module example * Small amount to see if I'm doing it right * Remove/cleanup redundant variables * Fix EnterTypingState impl for doc inheritance * Fix Test to resolve changes made in 15b58e * Improve precondition documentation + Add precondition usage sample + Add precondition group usage sample + Move precondition samples to its own sample folder * Move samples to individual folders * Clarify token source * Cleanup styling of README.md for docs * Replace InvalidPathChars for NS1.3 * InvalidPathChars does not exist in NS1.3; replaced with GetInvalidPathChars instead. * Add a missing change for 2c7cc738 * Update LastModified to v1.1.0 & add license * Rewrite installation page for Core 2.1 * Fix anchor link * Bump post-processor to v1.1.1 * Add fixes to partial file & add license * Moved theme-switcher code to scripts partial file + Add author's MIT license to featherlight javascript * Remove unused bootstrap plugin * Bump LastModified plugin * Changed the path from 'lastmodified' to 'last-modified' for consistency * Cleanup README & Contribution guide * Changes to last pr * Fix GetCategoryAsync docs * Proofread and cleanup articles * Change passive voice in "Get Started" to active * Fix improper preposition in Commands Introduction page * Fix minor grammar mistakes in "Your First Bot" (future tense -> present tense/subjunctive mood -> indicative mood/proper noun casing/incorrect noun/add missing article) * Fix minor grammar mistakes in "Installation" (missing article) * no hablo ingles * Try try try again * I'm sure you're having as much fun as I am * Cleanup TOC & fix titles * Improve styling + Change title font to Noto Sans + Add materialized design for commit message box * Add DescriptionGenerator plugin * Add nightly section for clarification * Fix typos in Nightlies & Post-execution * Bump DescriptionGenerator to v1.1.0 + This build adds the functionality of generating managed references' summary into the description tag. * Initial emoji article draft * Add 'additional information' section for emoji article * Add cosmetic changes to the master css * Alter info box color + Add transition to article content * Add clarification in the emoji article * Emphasize that normal emoji string will not translate to its Unicode representation. * Clean up or add some of the samples featured in the article. + Add emoji/emote declaration section for clarification. + Add WebSocket emote sample. - Remove inconsistent styling ('wacky memes' proves to be too out of place). * Improve readability for nightlies article * Move 'Bundled Preconditions' section * Bump LastModified to fix UTC DateTime parsing * Add langwordMapping.yml * Add XML docs * Add VSC workspace rule * The root workspace limits the ruler to 120 characters for member documentations and excludes folders such as 'samples' and 'docs'. * The docs workspace limits the ruler to 70 characters for standard conceptual article to comply with documentation's CONTRIBUTING.md rule, and excludes temprorary folders created by DocFX. * Update CONTRIBUTING.md * Add documentation style rule * Fix styling of several member documentation * Fix ' />' caused by Agent Smith oddities * Fix styling to be more specific about the mention of IDs * Fix exception summary to comply with official Microsoft Docs style * References https://docs.microsoft.com/en-us/dotnet/api/system.argumentnullexception?view=netframework-4.7.2 https://docs.microsoft.com/en-us/dotnet/api/system.platformnotsupportedexception?view=netframework-4.7.2 https://docs.microsoft.com/en-us/dotnet/api/system.badimageformatexception?view=netframework-4.7.2 * Add XML documentations * Shift color return docs * Fix minor docs * Added documentation for SocketDMChannel, SocketGuildChannel, and SocketTextChannel * Add XML docs * Corrections to SocketGuildChannel * Corrections to SocketTextChannel * Corrections to SocketDMChannel * Swapped out 'id' for 'snowflake identifier * Swapped out 'id' for 'snowflake identifier' * SocketDMChannel amendments * SocketGuildChannel amendments * SocketTextChannel amendments * Add XML docs & patch return types + Starting from this commit, all return types for tasks will use style similar to most documentations featured on docs.microsoft.com References: https://docs.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.dbcontext.-ctor?view=efcore-2.1 https://docs.microsoft.com/en-us/dotnet/api/system.io.filestream.readasync?view=netcore-2.1 https://docs.microsoft.com/en-us/dotnet/api/system.io.textwriter.writelineasync?view=netcore-2.1#System_IO_TextWriter_WriteLineAsync_System_Char___ And many more other asynchronous method documentations featured in the latest BCL. * Added documentation for many audit log data types, fixed vowel indefinite articles * Change audit log data types to start with 'Contains' (verb) instead of an article * Fix some documentation issues and document some more audit log data types * Fix English posession * Add XML doc * Documented two more types * Documented RoleCreateAuditLogData * Document remaining audit log data types * Added RestDMChannel documentation * Added RestGuildChannel documentation * Added RestTextChannel documentation * Added RestVoiceChannel documentation * Added RestUser documentation * Added RestRole documentation * Added RestMessage documentation * Slightly better wording * Contains -> Contains a piece of (describe article) * [EN] Present perf. -> past perf. * Add XML docs * Fix arrow alignment * Clarify supported nullable type * Fixed a typo in ISnowflakeEntity * Added RestUser Documentation * Added RestInvite documentation * Add XML docs & minor optimizations * Minor optimization for doc rendering * Rollback font optimization changes * Amendments to RestUser * Added SocketDMChannel documentation * Added RestDMChannel documentation * Added RestGuild documentation * Adjustment to SocketDMChannel * Added minimal descriptions from the API documentation for Integration types * Added obsolete mention to the ReadMessages flag. * Added remarks about 2FA requirement for guild permissions * Added xmldoc for GuildPermission methods * Added xml doc for ToAllowList and ToDenyList * Added specification of how the bits of the color raw value are packed * Added discord API documentation to IConnection interface * I can spell :^) * Fix whitespace in ChannelPermission * fix spacing of values in guildpermission * Made changes to get field descriptions from feedback, added returns tag to IConnection * Added property get standard for IntegrationAccount * Added property get pattern to xml docs and identical returns tag. * Change all color class references to struct ...because it isn't a class. * Add XML docs * Rewrote the returns tags in IGuildIntegration, removed the ones I was unsure about. * Rewrote the rest of the returns tags * Amendments * Cleanup doc for c1d78189 * Added types to <returns> tags where missing * Added second sample for adding reactions * Added some class summaries * Missed a period * Amendments * restored the removed line break * Removed unnecessary see tag * Use consistent quotation marks around subscribers, the name for these users are dependant on the source of where they are integrated from (youtube or twitch), so we should not use a name that is specific to one platform * Add <remarks> tag to the IGuildIntegration xmldocs * Fix grammar issue * Update DescriptionGenerator * Cleanup of https://github.com/Still34/Discord.Net/pull/8 * Cleanup previous PR * Fix for misleading behaviour in the emoji guide + Original lines stated that sending a emoji wrapped in colon will not be parsed, but that was incorrect; replaced with reactions instead of sending messages as the example * Add strings for dictionary in DotSettings * Add XML docs * Fix lots of typos in comments + Geez, I didn't know there were so many. * Add XML docs & rewrite GetMessagesAsync docs This commit rewrites the remarks section of GetMessagesAsync, as well as adding examples to several methods. * Update 'Your First Bot' + This commit reflects the new changes made to the Discord Application Developer Portal after its major update * Initial optimization for DocFX render & add missing files * Add examples in message methods * Cleanup https://github.com/RogueException/Discord.Net/pull/1128 * Fix first bot note * Cleanup FAQ structure * Add XML docs * Update docfx plugins * Fix navbar collapsing issue * Fix broken xref * Cleanup FAQ section + Add introductory paragraphs to each FAQ section. + Add 'missing dependency' entry to commands FAQ. * Split commands FAQ to 'General' and 'DI' sections. * Cleanup https://github.com/RogueException/Discord.Net/pull/1139 * Fix missing namespace * Add missing highlighting css for the light theme * Add additional clarification for installing packages * Add indentation to example for clarity * Cleanup several articles to be more human-friendly and easier to read * Remove RPC-related notes * Cleanup slow-mode-related documentation strings * Add an additional note about cross-guild emote usage * Add CreateTextChannel sample * Add XMLDocs
7 years ago
Documentation Overhaul (#1161) * Add XML docs * Clean up style switcher * Squash commits on branch docs/faq-n-patches * Fix broken theme selector * Add local image embed instruction * Add a bunch of XML docs * Add a bunch of XML docs * Fix broken search + DocFX by default ships with an older version of jQuery, switching to a newer version confuses parts of the DocFX Javascript. * Minor fixes for CONTRIBUTING.md and README.md * Clean up filterConfig.yml + New config exposes Discord.Net namespace since it has several common public exceptions that may be helpful to users * Add XML docs * Read token from Environment Variable instead of hardcode * Add XMLDocs * Compress some assets & add OAuth2 URL generator * Fix sample link & add missing pictures * Add tag examples * Fix embed docs consistency * Add details regarding userbot support * Add XML Docs * Add XML Docs * Add XML Docs * Minor fixes in documentations + Fix unescaped '<' + Fix typo * Fix seealso for preconditions and add missing descriptions * Add missing exceptions * Document exposed TypeReaders * Fix letter-casing for files * Add 'last modified' plugin Source: https://github.com/Still34/DocFx.Plugin.LastModified Licensed under MIT License * XML Docs * Fix minor consistencies & redundant impl * Add properties examples to overwrite * Fix missing Username prop * Add warning for bulk-delete endpoint * Replace note block * Add BaseSocketClient docs * Add XML docs * Replace langword null to code block null instead - Because DocFX sucks at rendering langword * Replace all langword placements with code block * Add more IGuild docs * Add details to SpotifyGame * Initial proofread of the articles * Add explanation for RunMode * Add event docs - MessageReceived - ChannelUpdated/Destroyed/Created * Fix light theme link color * Fix xml docs error * Add partial documentation for audit log impl * Add documentation for some REST-based objects * Add partial documentation for audit log objects * Add more XML comments to quotation mark alias map stuff, including an example * Add reference to CommandServiceConfig from the util docs' * Add explanation that if " is removed then it wont work * Fix missing service provider in example * Add documentation for new INestedChannel * Add documentation * Add documentation for new API version & few events * Revise guide paragraphs/samples + Fix various formatting. + Provide a more detailed walkthrough for dependency injection. + Add C# note at intro. * Fix typos & formatting * Improve group module example * Small amount to see if I'm doing it right * Remove/cleanup redundant variables * Fix EnterTypingState impl for doc inheritance * Fix Test to resolve changes made in 15b58e * Improve precondition documentation + Add precondition usage sample + Add precondition group usage sample + Move precondition samples to its own sample folder * Move samples to individual folders * Clarify token source * Cleanup styling of README.md for docs * Replace InvalidPathChars for NS1.3 * InvalidPathChars does not exist in NS1.3; replaced with GetInvalidPathChars instead. * Add a missing change for 2c7cc738 * Update LastModified to v1.1.0 & add license * Rewrite installation page for Core 2.1 * Fix anchor link * Bump post-processor to v1.1.1 * Add fixes to partial file & add license * Moved theme-switcher code to scripts partial file + Add author's MIT license to featherlight javascript * Remove unused bootstrap plugin * Bump LastModified plugin * Changed the path from 'lastmodified' to 'last-modified' for consistency * Cleanup README & Contribution guide * Changes to last pr * Fix GetCategoryAsync docs * Proofread and cleanup articles * Change passive voice in "Get Started" to active * Fix improper preposition in Commands Introduction page * Fix minor grammar mistakes in "Your First Bot" (future tense -> present tense/subjunctive mood -> indicative mood/proper noun casing/incorrect noun/add missing article) * Fix minor grammar mistakes in "Installation" (missing article) * no hablo ingles * Try try try again * I'm sure you're having as much fun as I am * Cleanup TOC & fix titles * Improve styling + Change title font to Noto Sans + Add materialized design for commit message box * Add DescriptionGenerator plugin * Add nightly section for clarification * Fix typos in Nightlies & Post-execution * Bump DescriptionGenerator to v1.1.0 + This build adds the functionality of generating managed references' summary into the description tag. * Initial emoji article draft * Add 'additional information' section for emoji article * Add cosmetic changes to the master css * Alter info box color + Add transition to article content * Add clarification in the emoji article * Emphasize that normal emoji string will not translate to its Unicode representation. * Clean up or add some of the samples featured in the article. + Add emoji/emote declaration section for clarification. + Add WebSocket emote sample. - Remove inconsistent styling ('wacky memes' proves to be too out of place). * Improve readability for nightlies article * Move 'Bundled Preconditions' section * Bump LastModified to fix UTC DateTime parsing * Add langwordMapping.yml * Add XML docs * Add VSC workspace rule * The root workspace limits the ruler to 120 characters for member documentations and excludes folders such as 'samples' and 'docs'. * The docs workspace limits the ruler to 70 characters for standard conceptual article to comply with documentation's CONTRIBUTING.md rule, and excludes temprorary folders created by DocFX. * Update CONTRIBUTING.md * Add documentation style rule * Fix styling of several member documentation * Fix ' />' caused by Agent Smith oddities * Fix styling to be more specific about the mention of IDs * Fix exception summary to comply with official Microsoft Docs style * References https://docs.microsoft.com/en-us/dotnet/api/system.argumentnullexception?view=netframework-4.7.2 https://docs.microsoft.com/en-us/dotnet/api/system.platformnotsupportedexception?view=netframework-4.7.2 https://docs.microsoft.com/en-us/dotnet/api/system.badimageformatexception?view=netframework-4.7.2 * Add XML documentations * Shift color return docs * Fix minor docs * Added documentation for SocketDMChannel, SocketGuildChannel, and SocketTextChannel * Add XML docs * Corrections to SocketGuildChannel * Corrections to SocketTextChannel * Corrections to SocketDMChannel * Swapped out 'id' for 'snowflake identifier * Swapped out 'id' for 'snowflake identifier' * SocketDMChannel amendments * SocketGuildChannel amendments * SocketTextChannel amendments * Add XML docs & patch return types + Starting from this commit, all return types for tasks will use style similar to most documentations featured on docs.microsoft.com References: https://docs.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.dbcontext.-ctor?view=efcore-2.1 https://docs.microsoft.com/en-us/dotnet/api/system.io.filestream.readasync?view=netcore-2.1 https://docs.microsoft.com/en-us/dotnet/api/system.io.textwriter.writelineasync?view=netcore-2.1#System_IO_TextWriter_WriteLineAsync_System_Char___ And many more other asynchronous method documentations featured in the latest BCL. * Added documentation for many audit log data types, fixed vowel indefinite articles * Change audit log data types to start with 'Contains' (verb) instead of an article * Fix some documentation issues and document some more audit log data types * Fix English posession * Add XML doc * Documented two more types * Documented RoleCreateAuditLogData * Document remaining audit log data types * Added RestDMChannel documentation * Added RestGuildChannel documentation * Added RestTextChannel documentation * Added RestVoiceChannel documentation * Added RestUser documentation * Added RestRole documentation * Added RestMessage documentation * Slightly better wording * Contains -> Contains a piece of (describe article) * [EN] Present perf. -> past perf. * Add XML docs * Fix arrow alignment * Clarify supported nullable type * Fixed a typo in ISnowflakeEntity * Added RestUser Documentation * Added RestInvite documentation * Add XML docs & minor optimizations * Minor optimization for doc rendering * Rollback font optimization changes * Amendments to RestUser * Added SocketDMChannel documentation * Added RestDMChannel documentation * Added RestGuild documentation * Adjustment to SocketDMChannel * Added minimal descriptions from the API documentation for Integration types * Added obsolete mention to the ReadMessages flag. * Added remarks about 2FA requirement for guild permissions * Added xmldoc for GuildPermission methods * Added xml doc for ToAllowList and ToDenyList * Added specification of how the bits of the color raw value are packed * Added discord API documentation to IConnection interface * I can spell :^) * Fix whitespace in ChannelPermission * fix spacing of values in guildpermission * Made changes to get field descriptions from feedback, added returns tag to IConnection * Added property get standard for IntegrationAccount * Added property get pattern to xml docs and identical returns tag. * Change all color class references to struct ...because it isn't a class. * Add XML docs * Rewrote the returns tags in IGuildIntegration, removed the ones I was unsure about. * Rewrote the rest of the returns tags * Amendments * Cleanup doc for c1d78189 * Added types to <returns> tags where missing * Added second sample for adding reactions * Added some class summaries * Missed a period * Amendments * restored the removed line break * Removed unnecessary see tag * Use consistent quotation marks around subscribers, the name for these users are dependant on the source of where they are integrated from (youtube or twitch), so we should not use a name that is specific to one platform * Add <remarks> tag to the IGuildIntegration xmldocs * Fix grammar issue * Update DescriptionGenerator * Cleanup of https://github.com/Still34/Discord.Net/pull/8 * Cleanup previous PR * Fix for misleading behaviour in the emoji guide + Original lines stated that sending a emoji wrapped in colon will not be parsed, but that was incorrect; replaced with reactions instead of sending messages as the example * Add strings for dictionary in DotSettings * Add XML docs * Fix lots of typos in comments + Geez, I didn't know there were so many. * Add XML docs & rewrite GetMessagesAsync docs This commit rewrites the remarks section of GetMessagesAsync, as well as adding examples to several methods. * Update 'Your First Bot' + This commit reflects the new changes made to the Discord Application Developer Portal after its major update * Initial optimization for DocFX render & add missing files * Add examples in message methods * Cleanup https://github.com/RogueException/Discord.Net/pull/1128 * Fix first bot note * Cleanup FAQ structure * Add XML docs * Update docfx plugins * Fix navbar collapsing issue * Fix broken xref * Cleanup FAQ section + Add introductory paragraphs to each FAQ section. + Add 'missing dependency' entry to commands FAQ. * Split commands FAQ to 'General' and 'DI' sections. * Cleanup https://github.com/RogueException/Discord.Net/pull/1139 * Fix missing namespace * Add missing highlighting css for the light theme * Add additional clarification for installing packages * Add indentation to example for clarity * Cleanup several articles to be more human-friendly and easier to read * Remove RPC-related notes * Cleanup slow-mode-related documentation strings * Add an additional note about cross-guild emote usage * Add CreateTextChannel sample * Add XMLDocs
7 years ago
Documentation Overhaul (#1161) * Add XML docs * Clean up style switcher * Squash commits on branch docs/faq-n-patches * Fix broken theme selector * Add local image embed instruction * Add a bunch of XML docs * Add a bunch of XML docs * Fix broken search + DocFX by default ships with an older version of jQuery, switching to a newer version confuses parts of the DocFX Javascript. * Minor fixes for CONTRIBUTING.md and README.md * Clean up filterConfig.yml + New config exposes Discord.Net namespace since it has several common public exceptions that may be helpful to users * Add XML docs * Read token from Environment Variable instead of hardcode * Add XMLDocs * Compress some assets & add OAuth2 URL generator * Fix sample link & add missing pictures * Add tag examples * Fix embed docs consistency * Add details regarding userbot support * Add XML Docs * Add XML Docs * Add XML Docs * Minor fixes in documentations + Fix unescaped '<' + Fix typo * Fix seealso for preconditions and add missing descriptions * Add missing exceptions * Document exposed TypeReaders * Fix letter-casing for files * Add 'last modified' plugin Source: https://github.com/Still34/DocFx.Plugin.LastModified Licensed under MIT License * XML Docs * Fix minor consistencies & redundant impl * Add properties examples to overwrite * Fix missing Username prop * Add warning for bulk-delete endpoint * Replace note block * Add BaseSocketClient docs * Add XML docs * Replace langword null to code block null instead - Because DocFX sucks at rendering langword * Replace all langword placements with code block * Add more IGuild docs * Add details to SpotifyGame * Initial proofread of the articles * Add explanation for RunMode * Add event docs - MessageReceived - ChannelUpdated/Destroyed/Created * Fix light theme link color * Fix xml docs error * Add partial documentation for audit log impl * Add documentation for some REST-based objects * Add partial documentation for audit log objects * Add more XML comments to quotation mark alias map stuff, including an example * Add reference to CommandServiceConfig from the util docs' * Add explanation that if " is removed then it wont work * Fix missing service provider in example * Add documentation for new INestedChannel * Add documentation * Add documentation for new API version & few events * Revise guide paragraphs/samples + Fix various formatting. + Provide a more detailed walkthrough for dependency injection. + Add C# note at intro. * Fix typos & formatting * Improve group module example * Small amount to see if I'm doing it right * Remove/cleanup redundant variables * Fix EnterTypingState impl for doc inheritance * Fix Test to resolve changes made in 15b58e * Improve precondition documentation + Add precondition usage sample + Add precondition group usage sample + Move precondition samples to its own sample folder * Move samples to individual folders * Clarify token source * Cleanup styling of README.md for docs * Replace InvalidPathChars for NS1.3 * InvalidPathChars does not exist in NS1.3; replaced with GetInvalidPathChars instead. * Add a missing change for 2c7cc738 * Update LastModified to v1.1.0 & add license * Rewrite installation page for Core 2.1 * Fix anchor link * Bump post-processor to v1.1.1 * Add fixes to partial file & add license * Moved theme-switcher code to scripts partial file + Add author's MIT license to featherlight javascript * Remove unused bootstrap plugin * Bump LastModified plugin * Changed the path from 'lastmodified' to 'last-modified' for consistency * Cleanup README & Contribution guide * Changes to last pr * Fix GetCategoryAsync docs * Proofread and cleanup articles * Change passive voice in "Get Started" to active * Fix improper preposition in Commands Introduction page * Fix minor grammar mistakes in "Your First Bot" (future tense -> present tense/subjunctive mood -> indicative mood/proper noun casing/incorrect noun/add missing article) * Fix minor grammar mistakes in "Installation" (missing article) * no hablo ingles * Try try try again * I'm sure you're having as much fun as I am * Cleanup TOC & fix titles * Improve styling + Change title font to Noto Sans + Add materialized design for commit message box * Add DescriptionGenerator plugin * Add nightly section for clarification * Fix typos in Nightlies & Post-execution * Bump DescriptionGenerator to v1.1.0 + This build adds the functionality of generating managed references' summary into the description tag. * Initial emoji article draft * Add 'additional information' section for emoji article * Add cosmetic changes to the master css * Alter info box color + Add transition to article content * Add clarification in the emoji article * Emphasize that normal emoji string will not translate to its Unicode representation. * Clean up or add some of the samples featured in the article. + Add emoji/emote declaration section for clarification. + Add WebSocket emote sample. - Remove inconsistent styling ('wacky memes' proves to be too out of place). * Improve readability for nightlies article * Move 'Bundled Preconditions' section * Bump LastModified to fix UTC DateTime parsing * Add langwordMapping.yml * Add XML docs * Add VSC workspace rule * The root workspace limits the ruler to 120 characters for member documentations and excludes folders such as 'samples' and 'docs'. * The docs workspace limits the ruler to 70 characters for standard conceptual article to comply with documentation's CONTRIBUTING.md rule, and excludes temprorary folders created by DocFX. * Update CONTRIBUTING.md * Add documentation style rule * Fix styling of several member documentation * Fix ' />' caused by Agent Smith oddities * Fix styling to be more specific about the mention of IDs * Fix exception summary to comply with official Microsoft Docs style * References https://docs.microsoft.com/en-us/dotnet/api/system.argumentnullexception?view=netframework-4.7.2 https://docs.microsoft.com/en-us/dotnet/api/system.platformnotsupportedexception?view=netframework-4.7.2 https://docs.microsoft.com/en-us/dotnet/api/system.badimageformatexception?view=netframework-4.7.2 * Add XML documentations * Shift color return docs * Fix minor docs * Added documentation for SocketDMChannel, SocketGuildChannel, and SocketTextChannel * Add XML docs * Corrections to SocketGuildChannel * Corrections to SocketTextChannel * Corrections to SocketDMChannel * Swapped out 'id' for 'snowflake identifier * Swapped out 'id' for 'snowflake identifier' * SocketDMChannel amendments * SocketGuildChannel amendments * SocketTextChannel amendments * Add XML docs & patch return types + Starting from this commit, all return types for tasks will use style similar to most documentations featured on docs.microsoft.com References: https://docs.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.dbcontext.-ctor?view=efcore-2.1 https://docs.microsoft.com/en-us/dotnet/api/system.io.filestream.readasync?view=netcore-2.1 https://docs.microsoft.com/en-us/dotnet/api/system.io.textwriter.writelineasync?view=netcore-2.1#System_IO_TextWriter_WriteLineAsync_System_Char___ And many more other asynchronous method documentations featured in the latest BCL. * Added documentation for many audit log data types, fixed vowel indefinite articles * Change audit log data types to start with 'Contains' (verb) instead of an article * Fix some documentation issues and document some more audit log data types * Fix English posession * Add XML doc * Documented two more types * Documented RoleCreateAuditLogData * Document remaining audit log data types * Added RestDMChannel documentation * Added RestGuildChannel documentation * Added RestTextChannel documentation * Added RestVoiceChannel documentation * Added RestUser documentation * Added RestRole documentation * Added RestMessage documentation * Slightly better wording * Contains -> Contains a piece of (describe article) * [EN] Present perf. -> past perf. * Add XML docs * Fix arrow alignment * Clarify supported nullable type * Fixed a typo in ISnowflakeEntity * Added RestUser Documentation * Added RestInvite documentation * Add XML docs & minor optimizations * Minor optimization for doc rendering * Rollback font optimization changes * Amendments to RestUser * Added SocketDMChannel documentation * Added RestDMChannel documentation * Added RestGuild documentation * Adjustment to SocketDMChannel * Added minimal descriptions from the API documentation for Integration types * Added obsolete mention to the ReadMessages flag. * Added remarks about 2FA requirement for guild permissions * Added xmldoc for GuildPermission methods * Added xml doc for ToAllowList and ToDenyList * Added specification of how the bits of the color raw value are packed * Added discord API documentation to IConnection interface * I can spell :^) * Fix whitespace in ChannelPermission * fix spacing of values in guildpermission * Made changes to get field descriptions from feedback, added returns tag to IConnection * Added property get standard for IntegrationAccount * Added property get pattern to xml docs and identical returns tag. * Change all color class references to struct ...because it isn't a class. * Add XML docs * Rewrote the returns tags in IGuildIntegration, removed the ones I was unsure about. * Rewrote the rest of the returns tags * Amendments * Cleanup doc for c1d78189 * Added types to <returns> tags where missing * Added second sample for adding reactions * Added some class summaries * Missed a period * Amendments * restored the removed line break * Removed unnecessary see tag * Use consistent quotation marks around subscribers, the name for these users are dependant on the source of where they are integrated from (youtube or twitch), so we should not use a name that is specific to one platform * Add <remarks> tag to the IGuildIntegration xmldocs * Fix grammar issue * Update DescriptionGenerator * Cleanup of https://github.com/Still34/Discord.Net/pull/8 * Cleanup previous PR * Fix for misleading behaviour in the emoji guide + Original lines stated that sending a emoji wrapped in colon will not be parsed, but that was incorrect; replaced with reactions instead of sending messages as the example * Add strings for dictionary in DotSettings * Add XML docs * Fix lots of typos in comments + Geez, I didn't know there were so many. * Add XML docs & rewrite GetMessagesAsync docs This commit rewrites the remarks section of GetMessagesAsync, as well as adding examples to several methods. * Update 'Your First Bot' + This commit reflects the new changes made to the Discord Application Developer Portal after its major update * Initial optimization for DocFX render & add missing files * Add examples in message methods * Cleanup https://github.com/RogueException/Discord.Net/pull/1128 * Fix first bot note * Cleanup FAQ structure * Add XML docs * Update docfx plugins * Fix navbar collapsing issue * Fix broken xref * Cleanup FAQ section + Add introductory paragraphs to each FAQ section. + Add 'missing dependency' entry to commands FAQ. * Split commands FAQ to 'General' and 'DI' sections. * Cleanup https://github.com/RogueException/Discord.Net/pull/1139 * Fix missing namespace * Add missing highlighting css for the light theme * Add additional clarification for installing packages * Add indentation to example for clarity * Cleanup several articles to be more human-friendly and easier to read * Remove RPC-related notes * Cleanup slow-mode-related documentation strings * Add an additional note about cross-guild emote usage * Add CreateTextChannel sample * Add XMLDocs
7 years ago
Documentation Overhaul (#1161) * Add XML docs * Clean up style switcher * Squash commits on branch docs/faq-n-patches * Fix broken theme selector * Add local image embed instruction * Add a bunch of XML docs * Add a bunch of XML docs * Fix broken search + DocFX by default ships with an older version of jQuery, switching to a newer version confuses parts of the DocFX Javascript. * Minor fixes for CONTRIBUTING.md and README.md * Clean up filterConfig.yml + New config exposes Discord.Net namespace since it has several common public exceptions that may be helpful to users * Add XML docs * Read token from Environment Variable instead of hardcode * Add XMLDocs * Compress some assets & add OAuth2 URL generator * Fix sample link & add missing pictures * Add tag examples * Fix embed docs consistency * Add details regarding userbot support * Add XML Docs * Add XML Docs * Add XML Docs * Minor fixes in documentations + Fix unescaped '<' + Fix typo * Fix seealso for preconditions and add missing descriptions * Add missing exceptions * Document exposed TypeReaders * Fix letter-casing for files * Add 'last modified' plugin Source: https://github.com/Still34/DocFx.Plugin.LastModified Licensed under MIT License * XML Docs * Fix minor consistencies & redundant impl * Add properties examples to overwrite * Fix missing Username prop * Add warning for bulk-delete endpoint * Replace note block * Add BaseSocketClient docs * Add XML docs * Replace langword null to code block null instead - Because DocFX sucks at rendering langword * Replace all langword placements with code block * Add more IGuild docs * Add details to SpotifyGame * Initial proofread of the articles * Add explanation for RunMode * Add event docs - MessageReceived - ChannelUpdated/Destroyed/Created * Fix light theme link color * Fix xml docs error * Add partial documentation for audit log impl * Add documentation for some REST-based objects * Add partial documentation for audit log objects * Add more XML comments to quotation mark alias map stuff, including an example * Add reference to CommandServiceConfig from the util docs' * Add explanation that if " is removed then it wont work * Fix missing service provider in example * Add documentation for new INestedChannel * Add documentation * Add documentation for new API version & few events * Revise guide paragraphs/samples + Fix various formatting. + Provide a more detailed walkthrough for dependency injection. + Add C# note at intro. * Fix typos & formatting * Improve group module example * Small amount to see if I'm doing it right * Remove/cleanup redundant variables * Fix EnterTypingState impl for doc inheritance * Fix Test to resolve changes made in 15b58e * Improve precondition documentation + Add precondition usage sample + Add precondition group usage sample + Move precondition samples to its own sample folder * Move samples to individual folders * Clarify token source * Cleanup styling of README.md for docs * Replace InvalidPathChars for NS1.3 * InvalidPathChars does not exist in NS1.3; replaced with GetInvalidPathChars instead. * Add a missing change for 2c7cc738 * Update LastModified to v1.1.0 & add license * Rewrite installation page for Core 2.1 * Fix anchor link * Bump post-processor to v1.1.1 * Add fixes to partial file & add license * Moved theme-switcher code to scripts partial file + Add author's MIT license to featherlight javascript * Remove unused bootstrap plugin * Bump LastModified plugin * Changed the path from 'lastmodified' to 'last-modified' for consistency * Cleanup README & Contribution guide * Changes to last pr * Fix GetCategoryAsync docs * Proofread and cleanup articles * Change passive voice in "Get Started" to active * Fix improper preposition in Commands Introduction page * Fix minor grammar mistakes in "Your First Bot" (future tense -> present tense/subjunctive mood -> indicative mood/proper noun casing/incorrect noun/add missing article) * Fix minor grammar mistakes in "Installation" (missing article) * no hablo ingles * Try try try again * I'm sure you're having as much fun as I am * Cleanup TOC & fix titles * Improve styling + Change title font to Noto Sans + Add materialized design for commit message box * Add DescriptionGenerator plugin * Add nightly section for clarification * Fix typos in Nightlies & Post-execution * Bump DescriptionGenerator to v1.1.0 + This build adds the functionality of generating managed references' summary into the description tag. * Initial emoji article draft * Add 'additional information' section for emoji article * Add cosmetic changes to the master css * Alter info box color + Add transition to article content * Add clarification in the emoji article * Emphasize that normal emoji string will not translate to its Unicode representation. * Clean up or add some of the samples featured in the article. + Add emoji/emote declaration section for clarification. + Add WebSocket emote sample. - Remove inconsistent styling ('wacky memes' proves to be too out of place). * Improve readability for nightlies article * Move 'Bundled Preconditions' section * Bump LastModified to fix UTC DateTime parsing * Add langwordMapping.yml * Add XML docs * Add VSC workspace rule * The root workspace limits the ruler to 120 characters for member documentations and excludes folders such as 'samples' and 'docs'. * The docs workspace limits the ruler to 70 characters for standard conceptual article to comply with documentation's CONTRIBUTING.md rule, and excludes temprorary folders created by DocFX. * Update CONTRIBUTING.md * Add documentation style rule * Fix styling of several member documentation * Fix ' />' caused by Agent Smith oddities * Fix styling to be more specific about the mention of IDs * Fix exception summary to comply with official Microsoft Docs style * References https://docs.microsoft.com/en-us/dotnet/api/system.argumentnullexception?view=netframework-4.7.2 https://docs.microsoft.com/en-us/dotnet/api/system.platformnotsupportedexception?view=netframework-4.7.2 https://docs.microsoft.com/en-us/dotnet/api/system.badimageformatexception?view=netframework-4.7.2 * Add XML documentations * Shift color return docs * Fix minor docs * Added documentation for SocketDMChannel, SocketGuildChannel, and SocketTextChannel * Add XML docs * Corrections to SocketGuildChannel * Corrections to SocketTextChannel * Corrections to SocketDMChannel * Swapped out 'id' for 'snowflake identifier * Swapped out 'id' for 'snowflake identifier' * SocketDMChannel amendments * SocketGuildChannel amendments * SocketTextChannel amendments * Add XML docs & patch return types + Starting from this commit, all return types for tasks will use style similar to most documentations featured on docs.microsoft.com References: https://docs.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.dbcontext.-ctor?view=efcore-2.1 https://docs.microsoft.com/en-us/dotnet/api/system.io.filestream.readasync?view=netcore-2.1 https://docs.microsoft.com/en-us/dotnet/api/system.io.textwriter.writelineasync?view=netcore-2.1#System_IO_TextWriter_WriteLineAsync_System_Char___ And many more other asynchronous method documentations featured in the latest BCL. * Added documentation for many audit log data types, fixed vowel indefinite articles * Change audit log data types to start with 'Contains' (verb) instead of an article * Fix some documentation issues and document some more audit log data types * Fix English posession * Add XML doc * Documented two more types * Documented RoleCreateAuditLogData * Document remaining audit log data types * Added RestDMChannel documentation * Added RestGuildChannel documentation * Added RestTextChannel documentation * Added RestVoiceChannel documentation * Added RestUser documentation * Added RestRole documentation * Added RestMessage documentation * Slightly better wording * Contains -> Contains a piece of (describe article) * [EN] Present perf. -> past perf. * Add XML docs * Fix arrow alignment * Clarify supported nullable type * Fixed a typo in ISnowflakeEntity * Added RestUser Documentation * Added RestInvite documentation * Add XML docs & minor optimizations * Minor optimization for doc rendering * Rollback font optimization changes * Amendments to RestUser * Added SocketDMChannel documentation * Added RestDMChannel documentation * Added RestGuild documentation * Adjustment to SocketDMChannel * Added minimal descriptions from the API documentation for Integration types * Added obsolete mention to the ReadMessages flag. * Added remarks about 2FA requirement for guild permissions * Added xmldoc for GuildPermission methods * Added xml doc for ToAllowList and ToDenyList * Added specification of how the bits of the color raw value are packed * Added discord API documentation to IConnection interface * I can spell :^) * Fix whitespace in ChannelPermission * fix spacing of values in guildpermission * Made changes to get field descriptions from feedback, added returns tag to IConnection * Added property get standard for IntegrationAccount * Added property get pattern to xml docs and identical returns tag. * Change all color class references to struct ...because it isn't a class. * Add XML docs * Rewrote the returns tags in IGuildIntegration, removed the ones I was unsure about. * Rewrote the rest of the returns tags * Amendments * Cleanup doc for c1d78189 * Added types to <returns> tags where missing * Added second sample for adding reactions * Added some class summaries * Missed a period * Amendments * restored the removed line break * Removed unnecessary see tag * Use consistent quotation marks around subscribers, the name for these users are dependant on the source of where they are integrated from (youtube or twitch), so we should not use a name that is specific to one platform * Add <remarks> tag to the IGuildIntegration xmldocs * Fix grammar issue * Update DescriptionGenerator * Cleanup of https://github.com/Still34/Discord.Net/pull/8 * Cleanup previous PR * Fix for misleading behaviour in the emoji guide + Original lines stated that sending a emoji wrapped in colon will not be parsed, but that was incorrect; replaced with reactions instead of sending messages as the example * Add strings for dictionary in DotSettings * Add XML docs * Fix lots of typos in comments + Geez, I didn't know there were so many. * Add XML docs & rewrite GetMessagesAsync docs This commit rewrites the remarks section of GetMessagesAsync, as well as adding examples to several methods. * Update 'Your First Bot' + This commit reflects the new changes made to the Discord Application Developer Portal after its major update * Initial optimization for DocFX render & add missing files * Add examples in message methods * Cleanup https://github.com/RogueException/Discord.Net/pull/1128 * Fix first bot note * Cleanup FAQ structure * Add XML docs * Update docfx plugins * Fix navbar collapsing issue * Fix broken xref * Cleanup FAQ section + Add introductory paragraphs to each FAQ section. + Add 'missing dependency' entry to commands FAQ. * Split commands FAQ to 'General' and 'DI' sections. * Cleanup https://github.com/RogueException/Discord.Net/pull/1139 * Fix missing namespace * Add missing highlighting css for the light theme * Add additional clarification for installing packages * Add indentation to example for clarity * Cleanup several articles to be more human-friendly and easier to read * Remove RPC-related notes * Cleanup slow-mode-related documentation strings * Add an additional note about cross-guild emote usage * Add CreateTextChannel sample * Add XMLDocs
7 years ago
4 years ago
Documentation Overhaul (#1161) * Add XML docs * Clean up style switcher * Squash commits on branch docs/faq-n-patches * Fix broken theme selector * Add local image embed instruction * Add a bunch of XML docs * Add a bunch of XML docs * Fix broken search + DocFX by default ships with an older version of jQuery, switching to a newer version confuses parts of the DocFX Javascript. * Minor fixes for CONTRIBUTING.md and README.md * Clean up filterConfig.yml + New config exposes Discord.Net namespace since it has several common public exceptions that may be helpful to users * Add XML docs * Read token from Environment Variable instead of hardcode * Add XMLDocs * Compress some assets & add OAuth2 URL generator * Fix sample link & add missing pictures * Add tag examples * Fix embed docs consistency * Add details regarding userbot support * Add XML Docs * Add XML Docs * Add XML Docs * Minor fixes in documentations + Fix unescaped '<' + Fix typo * Fix seealso for preconditions and add missing descriptions * Add missing exceptions * Document exposed TypeReaders * Fix letter-casing for files * Add 'last modified' plugin Source: https://github.com/Still34/DocFx.Plugin.LastModified Licensed under MIT License * XML Docs * Fix minor consistencies & redundant impl * Add properties examples to overwrite * Fix missing Username prop * Add warning for bulk-delete endpoint * Replace note block * Add BaseSocketClient docs * Add XML docs * Replace langword null to code block null instead - Because DocFX sucks at rendering langword * Replace all langword placements with code block * Add more IGuild docs * Add details to SpotifyGame * Initial proofread of the articles * Add explanation for RunMode * Add event docs - MessageReceived - ChannelUpdated/Destroyed/Created * Fix light theme link color * Fix xml docs error * Add partial documentation for audit log impl * Add documentation for some REST-based objects * Add partial documentation for audit log objects * Add more XML comments to quotation mark alias map stuff, including an example * Add reference to CommandServiceConfig from the util docs' * Add explanation that if " is removed then it wont work * Fix missing service provider in example * Add documentation for new INestedChannel * Add documentation * Add documentation for new API version & few events * Revise guide paragraphs/samples + Fix various formatting. + Provide a more detailed walkthrough for dependency injection. + Add C# note at intro. * Fix typos & formatting * Improve group module example * Small amount to see if I'm doing it right * Remove/cleanup redundant variables * Fix EnterTypingState impl for doc inheritance * Fix Test to resolve changes made in 15b58e * Improve precondition documentation + Add precondition usage sample + Add precondition group usage sample + Move precondition samples to its own sample folder * Move samples to individual folders * Clarify token source * Cleanup styling of README.md for docs * Replace InvalidPathChars for NS1.3 * InvalidPathChars does not exist in NS1.3; replaced with GetInvalidPathChars instead. * Add a missing change for 2c7cc738 * Update LastModified to v1.1.0 & add license * Rewrite installation page for Core 2.1 * Fix anchor link * Bump post-processor to v1.1.1 * Add fixes to partial file & add license * Moved theme-switcher code to scripts partial file + Add author's MIT license to featherlight javascript * Remove unused bootstrap plugin * Bump LastModified plugin * Changed the path from 'lastmodified' to 'last-modified' for consistency * Cleanup README & Contribution guide * Changes to last pr * Fix GetCategoryAsync docs * Proofread and cleanup articles * Change passive voice in "Get Started" to active * Fix improper preposition in Commands Introduction page * Fix minor grammar mistakes in "Your First Bot" (future tense -> present tense/subjunctive mood -> indicative mood/proper noun casing/incorrect noun/add missing article) * Fix minor grammar mistakes in "Installation" (missing article) * no hablo ingles * Try try try again * I'm sure you're having as much fun as I am * Cleanup TOC & fix titles * Improve styling + Change title font to Noto Sans + Add materialized design for commit message box * Add DescriptionGenerator plugin * Add nightly section for clarification * Fix typos in Nightlies & Post-execution * Bump DescriptionGenerator to v1.1.0 + This build adds the functionality of generating managed references' summary into the description tag. * Initial emoji article draft * Add 'additional information' section for emoji article * Add cosmetic changes to the master css * Alter info box color + Add transition to article content * Add clarification in the emoji article * Emphasize that normal emoji string will not translate to its Unicode representation. * Clean up or add some of the samples featured in the article. + Add emoji/emote declaration section for clarification. + Add WebSocket emote sample. - Remove inconsistent styling ('wacky memes' proves to be too out of place). * Improve readability for nightlies article * Move 'Bundled Preconditions' section * Bump LastModified to fix UTC DateTime parsing * Add langwordMapping.yml * Add XML docs * Add VSC workspace rule * The root workspace limits the ruler to 120 characters for member documentations and excludes folders such as 'samples' and 'docs'. * The docs workspace limits the ruler to 70 characters for standard conceptual article to comply with documentation's CONTRIBUTING.md rule, and excludes temprorary folders created by DocFX. * Update CONTRIBUTING.md * Add documentation style rule * Fix styling of several member documentation * Fix ' />' caused by Agent Smith oddities * Fix styling to be more specific about the mention of IDs * Fix exception summary to comply with official Microsoft Docs style * References https://docs.microsoft.com/en-us/dotnet/api/system.argumentnullexception?view=netframework-4.7.2 https://docs.microsoft.com/en-us/dotnet/api/system.platformnotsupportedexception?view=netframework-4.7.2 https://docs.microsoft.com/en-us/dotnet/api/system.badimageformatexception?view=netframework-4.7.2 * Add XML documentations * Shift color return docs * Fix minor docs * Added documentation for SocketDMChannel, SocketGuildChannel, and SocketTextChannel * Add XML docs * Corrections to SocketGuildChannel * Corrections to SocketTextChannel * Corrections to SocketDMChannel * Swapped out 'id' for 'snowflake identifier * Swapped out 'id' for 'snowflake identifier' * SocketDMChannel amendments * SocketGuildChannel amendments * SocketTextChannel amendments * Add XML docs & patch return types + Starting from this commit, all return types for tasks will use style similar to most documentations featured on docs.microsoft.com References: https://docs.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.dbcontext.-ctor?view=efcore-2.1 https://docs.microsoft.com/en-us/dotnet/api/system.io.filestream.readasync?view=netcore-2.1 https://docs.microsoft.com/en-us/dotnet/api/system.io.textwriter.writelineasync?view=netcore-2.1#System_IO_TextWriter_WriteLineAsync_System_Char___ And many more other asynchronous method documentations featured in the latest BCL. * Added documentation for many audit log data types, fixed vowel indefinite articles * Change audit log data types to start with 'Contains' (verb) instead of an article * Fix some documentation issues and document some more audit log data types * Fix English posession * Add XML doc * Documented two more types * Documented RoleCreateAuditLogData * Document remaining audit log data types * Added RestDMChannel documentation * Added RestGuildChannel documentation * Added RestTextChannel documentation * Added RestVoiceChannel documentation * Added RestUser documentation * Added RestRole documentation * Added RestMessage documentation * Slightly better wording * Contains -> Contains a piece of (describe article) * [EN] Present perf. -> past perf. * Add XML docs * Fix arrow alignment * Clarify supported nullable type * Fixed a typo in ISnowflakeEntity * Added RestUser Documentation * Added RestInvite documentation * Add XML docs & minor optimizations * Minor optimization for doc rendering * Rollback font optimization changes * Amendments to RestUser * Added SocketDMChannel documentation * Added RestDMChannel documentation * Added RestGuild documentation * Adjustment to SocketDMChannel * Added minimal descriptions from the API documentation for Integration types * Added obsolete mention to the ReadMessages flag. * Added remarks about 2FA requirement for guild permissions * Added xmldoc for GuildPermission methods * Added xml doc for ToAllowList and ToDenyList * Added specification of how the bits of the color raw value are packed * Added discord API documentation to IConnection interface * I can spell :^) * Fix whitespace in ChannelPermission * fix spacing of values in guildpermission * Made changes to get field descriptions from feedback, added returns tag to IConnection * Added property get standard for IntegrationAccount * Added property get pattern to xml docs and identical returns tag. * Change all color class references to struct ...because it isn't a class. * Add XML docs * Rewrote the returns tags in IGuildIntegration, removed the ones I was unsure about. * Rewrote the rest of the returns tags * Amendments * Cleanup doc for c1d78189 * Added types to <returns> tags where missing * Added second sample for adding reactions * Added some class summaries * Missed a period * Amendments * restored the removed line break * Removed unnecessary see tag * Use consistent quotation marks around subscribers, the name for these users are dependant on the source of where they are integrated from (youtube or twitch), so we should not use a name that is specific to one platform * Add <remarks> tag to the IGuildIntegration xmldocs * Fix grammar issue * Update DescriptionGenerator * Cleanup of https://github.com/Still34/Discord.Net/pull/8 * Cleanup previous PR * Fix for misleading behaviour in the emoji guide + Original lines stated that sending a emoji wrapped in colon will not be parsed, but that was incorrect; replaced with reactions instead of sending messages as the example * Add strings for dictionary in DotSettings * Add XML docs * Fix lots of typos in comments + Geez, I didn't know there were so many. * Add XML docs & rewrite GetMessagesAsync docs This commit rewrites the remarks section of GetMessagesAsync, as well as adding examples to several methods. * Update 'Your First Bot' + This commit reflects the new changes made to the Discord Application Developer Portal after its major update * Initial optimization for DocFX render & add missing files * Add examples in message methods * Cleanup https://github.com/RogueException/Discord.Net/pull/1128 * Fix first bot note * Cleanup FAQ structure * Add XML docs * Update docfx plugins * Fix navbar collapsing issue * Fix broken xref * Cleanup FAQ section + Add introductory paragraphs to each FAQ section. + Add 'missing dependency' entry to commands FAQ. * Split commands FAQ to 'General' and 'DI' sections. * Cleanup https://github.com/RogueException/Discord.Net/pull/1139 * Fix missing namespace * Add missing highlighting css for the light theme * Add additional clarification for installing packages * Add indentation to example for clarity * Cleanup several articles to be more human-friendly and easier to read * Remove RPC-related notes * Cleanup slow-mode-related documentation strings * Add an additional note about cross-guild emote usage * Add CreateTextChannel sample * Add XMLDocs
7 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413
  1. using Discord.API.Rest;
  2. using Discord.Net;
  3. using Discord.Net.Converters;
  4. using Discord.Net.Queue;
  5. using Discord.Net.Rest;
  6. using Newtonsoft.Json;
  7. using System;
  8. using System.Collections.Concurrent;
  9. using System.Collections.Generic;
  10. using System.Diagnostics;
  11. using System.Globalization;
  12. using System.IO;
  13. using System.Linq;
  14. using System.Linq.Expressions;
  15. using System.Net;
  16. using System.Runtime.CompilerServices;
  17. using System.Text;
  18. using System.Threading;
  19. using System.Threading.Tasks;
  20. namespace Discord.API
  21. {
  22. internal class DiscordRestApiClient : IDisposable
  23. {
  24. #region DiscordRestApiClient
  25. private static readonly ConcurrentDictionary<string, Func<BucketIds, BucketId>> _bucketIdGenerators = new ConcurrentDictionary<string, Func<BucketIds, BucketId>>();
  26. public event Func<string, string, double, Task> SentRequest { add { _sentRequestEvent.Add(value); } remove { _sentRequestEvent.Remove(value); } }
  27. private readonly AsyncEvent<Func<string, string, double, Task>> _sentRequestEvent = new AsyncEvent<Func<string, string, double, Task>>();
  28. protected readonly JsonSerializer _serializer;
  29. protected readonly SemaphoreSlim _stateLock;
  30. private readonly RestClientProvider _restClientProvider;
  31. protected bool _isDisposed;
  32. private CancellationTokenSource _loginCancelToken;
  33. public RetryMode DefaultRetryMode { get; }
  34. public string UserAgent { get; }
  35. internal RequestQueue RequestQueue { get; }
  36. public LoginState LoginState { get; private set; }
  37. public TokenType AuthTokenType { get; private set; }
  38. internal string AuthToken { get; private set; }
  39. internal IRestClient RestClient { get; private set; }
  40. internal ulong? CurrentUserId { get; set; }
  41. internal bool UseSystemClock { get; set; }
  42. internal JsonSerializer Serializer => _serializer;
  43. /// <exception cref="ArgumentException">Unknown OAuth token type.</exception>
  44. public DiscordRestApiClient(RestClientProvider restClientProvider, string userAgent, RetryMode defaultRetryMode = RetryMode.AlwaysRetry,
  45. JsonSerializer serializer = null, bool useSystemClock = true)
  46. {
  47. _restClientProvider = restClientProvider;
  48. UserAgent = userAgent;
  49. DefaultRetryMode = defaultRetryMode;
  50. _serializer = serializer ?? new JsonSerializer { ContractResolver = new DiscordContractResolver(), NullValueHandling = NullValueHandling.Include };
  51. UseSystemClock = useSystemClock;
  52. RequestQueue = new RequestQueue();
  53. _stateLock = new SemaphoreSlim(1, 1);
  54. SetBaseUrl(DiscordConfig.APIUrl);
  55. }
  56. /// <exception cref="ArgumentException">Unknown OAuth token type.</exception>
  57. internal void SetBaseUrl(string baseUrl)
  58. {
  59. RestClient?.Dispose();
  60. RestClient = _restClientProvider(baseUrl);
  61. RestClient.SetHeader("accept", "*/*");
  62. RestClient.SetHeader("user-agent", UserAgent);
  63. RestClient.SetHeader("authorization", GetPrefixedToken(AuthTokenType, AuthToken));
  64. }
  65. /// <exception cref="ArgumentException">Unknown OAuth token type.</exception>
  66. internal static string GetPrefixedToken(TokenType tokenType, string token)
  67. {
  68. return tokenType switch
  69. {
  70. TokenType.Bot => $"Bot {token}",
  71. TokenType.Bearer => $"Bearer {token}",
  72. _ => throw new ArgumentException(message: "Unknown OAuth token type.", paramName: nameof(tokenType)),
  73. };
  74. }
  75. internal virtual void Dispose(bool disposing)
  76. {
  77. if (!_isDisposed)
  78. {
  79. if (disposing)
  80. {
  81. _loginCancelToken?.Dispose();
  82. RestClient?.Dispose();
  83. RequestQueue?.Dispose();
  84. _stateLock?.Dispose();
  85. }
  86. _isDisposed = true;
  87. }
  88. }
  89. public void Dispose() => Dispose(true);
  90. public async Task LoginAsync(TokenType tokenType, string token, RequestOptions options = null)
  91. {
  92. await _stateLock.WaitAsync().ConfigureAwait(false);
  93. try
  94. {
  95. await LoginInternalAsync(tokenType, token, options).ConfigureAwait(false);
  96. }
  97. finally { _stateLock.Release(); }
  98. }
  99. private async Task LoginInternalAsync(TokenType tokenType, string token, RequestOptions options = null)
  100. {
  101. if (LoginState != LoginState.LoggedOut)
  102. await LogoutInternalAsync().ConfigureAwait(false);
  103. LoginState = LoginState.LoggingIn;
  104. try
  105. {
  106. _loginCancelToken?.Dispose();
  107. _loginCancelToken = new CancellationTokenSource();
  108. AuthToken = null;
  109. await RequestQueue.SetCancelTokenAsync(_loginCancelToken.Token).ConfigureAwait(false);
  110. RestClient.SetCancelToken(_loginCancelToken.Token);
  111. AuthTokenType = tokenType;
  112. AuthToken = token?.TrimEnd();
  113. if (tokenType != TokenType.Webhook)
  114. RestClient.SetHeader("authorization", GetPrefixedToken(AuthTokenType, AuthToken));
  115. LoginState = LoginState.LoggedIn;
  116. }
  117. catch
  118. {
  119. await LogoutInternalAsync().ConfigureAwait(false);
  120. throw;
  121. }
  122. }
  123. public async Task LogoutAsync()
  124. {
  125. await _stateLock.WaitAsync().ConfigureAwait(false);
  126. try
  127. {
  128. await LogoutInternalAsync().ConfigureAwait(false);
  129. }
  130. finally { _stateLock.Release(); }
  131. }
  132. private async Task LogoutInternalAsync()
  133. {
  134. //An exception here will lock the client into the unusable LoggingOut state, but that's probably fine since our client is in an undefined state too.
  135. if (LoginState == LoginState.LoggedOut) return;
  136. LoginState = LoginState.LoggingOut;
  137. try { _loginCancelToken?.Cancel(false); }
  138. catch { }
  139. await DisconnectInternalAsync(null).ConfigureAwait(false);
  140. await RequestQueue.ClearAsync().ConfigureAwait(false);
  141. await RequestQueue.SetCancelTokenAsync(CancellationToken.None).ConfigureAwait(false);
  142. RestClient.SetCancelToken(CancellationToken.None);
  143. CurrentUserId = null;
  144. LoginState = LoginState.LoggedOut;
  145. }
  146. internal virtual Task ConnectInternalAsync() => Task.Delay(0);
  147. internal virtual Task DisconnectInternalAsync(Exception ex = null) => Task.Delay(0);
  148. #endregion
  149. #region Core
  150. internal Task SendAsync(string method, Expression<Func<string>> endpointExpr, BucketIds ids,
  151. ClientBucketType clientBucket = ClientBucketType.Unbucketed, RequestOptions options = null, [CallerMemberName] string funcName = null)
  152. => SendAsync(method, GetEndpoint(endpointExpr), GetBucketId(method, ids, endpointExpr, funcName), clientBucket, options);
  153. public async Task SendAsync(string method, string endpoint,
  154. BucketId bucketId = null, ClientBucketType clientBucket = ClientBucketType.Unbucketed, RequestOptions options = null)
  155. {
  156. options ??= new RequestOptions();
  157. options.HeaderOnly = true;
  158. options.BucketId = bucketId;
  159. var request = new RestRequest(RestClient, method, endpoint, options);
  160. await SendInternalAsync(method, endpoint, request).ConfigureAwait(false);
  161. }
  162. internal Task SendJsonAsync(string method, Expression<Func<string>> endpointExpr, object payload, BucketIds ids,
  163. ClientBucketType clientBucket = ClientBucketType.Unbucketed, RequestOptions options = null, [CallerMemberName] string funcName = null)
  164. => SendJsonAsync(method, GetEndpoint(endpointExpr), payload, GetBucketId(method, ids, endpointExpr, funcName), clientBucket, options);
  165. public async Task SendJsonAsync(string method, string endpoint, object payload,
  166. BucketId bucketId = null, ClientBucketType clientBucket = ClientBucketType.Unbucketed, RequestOptions options = null)
  167. {
  168. options ??= new RequestOptions();
  169. options.HeaderOnly = true;
  170. options.BucketId = bucketId;
  171. string json = payload != null ? SerializeJson(payload) : null;
  172. var request = new JsonRestRequest(RestClient, method, endpoint, json, options);
  173. await SendInternalAsync(method, endpoint, request).ConfigureAwait(false);
  174. }
  175. internal Task SendMultipartAsync(string method, Expression<Func<string>> endpointExpr, IReadOnlyDictionary<string, object> multipartArgs, BucketIds ids,
  176. ClientBucketType clientBucket = ClientBucketType.Unbucketed, RequestOptions options = null, [CallerMemberName] string funcName = null)
  177. => SendMultipartAsync(method, GetEndpoint(endpointExpr), multipartArgs, GetBucketId(method, ids, endpointExpr, funcName), clientBucket, options);
  178. public async Task SendMultipartAsync(string method, string endpoint, IReadOnlyDictionary<string, object> multipartArgs,
  179. BucketId bucketId = null, ClientBucketType clientBucket = ClientBucketType.Unbucketed, RequestOptions options = null)
  180. {
  181. options ??= new RequestOptions();
  182. options.HeaderOnly = true;
  183. options.BucketId = bucketId;
  184. var request = new MultipartRestRequest(RestClient, method, endpoint, multipartArgs, options);
  185. await SendInternalAsync(method, endpoint, request).ConfigureAwait(false);
  186. }
  187. internal Task<TResponse> SendAsync<TResponse>(string method, Expression<Func<string>> endpointExpr, BucketIds ids,
  188. ClientBucketType clientBucket = ClientBucketType.Unbucketed, RequestOptions options = null, [CallerMemberName] string funcName = null) where TResponse : class
  189. => SendAsync<TResponse>(method, GetEndpoint(endpointExpr), GetBucketId(method, ids, endpointExpr, funcName), clientBucket, options);
  190. public async Task<TResponse> SendAsync<TResponse>(string method, string endpoint,
  191. BucketId bucketId = null, ClientBucketType clientBucket = ClientBucketType.Unbucketed, RequestOptions options = null) where TResponse : class
  192. {
  193. options ??= new RequestOptions();
  194. options.BucketId = bucketId;
  195. var request = new RestRequest(RestClient, method, endpoint, options);
  196. return DeserializeJson<TResponse>(await SendInternalAsync(method, endpoint, request).ConfigureAwait(false));
  197. }
  198. internal Task<TResponse> SendJsonAsync<TResponse>(string method, Expression<Func<string>> endpointExpr, object payload, BucketIds ids,
  199. ClientBucketType clientBucket = ClientBucketType.Unbucketed, RequestOptions options = null, [CallerMemberName] string funcName = null) where TResponse : class
  200. => SendJsonAsync<TResponse>(method, GetEndpoint(endpointExpr), payload, GetBucketId(method, ids, endpointExpr, funcName), clientBucket, options);
  201. public async Task<TResponse> SendJsonAsync<TResponse>(string method, string endpoint, object payload,
  202. BucketId bucketId = null, ClientBucketType clientBucket = ClientBucketType.Unbucketed, RequestOptions options = null) where TResponse : class
  203. {
  204. options ??= new RequestOptions();
  205. options.BucketId = bucketId;
  206. string json = payload != null ? SerializeJson(payload) : null;
  207. var request = new JsonRestRequest(RestClient, method, endpoint, json, options);
  208. return DeserializeJson<TResponse>(await SendInternalAsync(method, endpoint, request).ConfigureAwait(false));
  209. }
  210. internal Task<TResponse> SendMultipartAsync<TResponse>(string method, Expression<Func<string>> endpointExpr, IReadOnlyDictionary<string, object> multipartArgs, BucketIds ids,
  211. ClientBucketType clientBucket = ClientBucketType.Unbucketed, RequestOptions options = null, [CallerMemberName] string funcName = null)
  212. => SendMultipartAsync<TResponse>(method, GetEndpoint(endpointExpr), multipartArgs, GetBucketId(method, ids, endpointExpr, funcName), clientBucket, options);
  213. public async Task<TResponse> SendMultipartAsync<TResponse>(string method, string endpoint, IReadOnlyDictionary<string, object> multipartArgs,
  214. BucketId bucketId = null, ClientBucketType clientBucket = ClientBucketType.Unbucketed, RequestOptions options = null)
  215. {
  216. options ??= new RequestOptions();
  217. options.BucketId = bucketId;
  218. var request = new MultipartRestRequest(RestClient, method, endpoint, multipartArgs, options);
  219. return DeserializeJson<TResponse>(await SendInternalAsync(method, endpoint, request).ConfigureAwait(false));
  220. }
  221. private async Task<Stream> SendInternalAsync(string method, string endpoint, RestRequest request)
  222. {
  223. if (!request.Options.IgnoreState)
  224. CheckState();
  225. if (request.Options.RetryMode == null)
  226. request.Options.RetryMode = DefaultRetryMode;
  227. if (request.Options.UseSystemClock == null)
  228. request.Options.UseSystemClock = UseSystemClock;
  229. var stopwatch = Stopwatch.StartNew();
  230. var responseStream = await RequestQueue.SendAsync(request).ConfigureAwait(false);
  231. stopwatch.Stop();
  232. double milliseconds = ToMilliseconds(stopwatch);
  233. await _sentRequestEvent.InvokeAsync(method, endpoint, milliseconds).ConfigureAwait(false);
  234. return responseStream;
  235. }
  236. #endregion
  237. #region Auth
  238. public async Task ValidateTokenAsync(RequestOptions options = null)
  239. {
  240. options = RequestOptions.CreateOrClone(options);
  241. await SendAsync("GET", () => "auth/login", new BucketIds(), options: options).ConfigureAwait(false);
  242. }
  243. #endregion
  244. #region Gateway
  245. public async Task<GetGatewayResponse> GetGatewayAsync(RequestOptions options = null)
  246. {
  247. options = RequestOptions.CreateOrClone(options);
  248. return await SendAsync<GetGatewayResponse>("GET", () => "gateway", new BucketIds(), options: options).ConfigureAwait(false);
  249. }
  250. public async Task<GetBotGatewayResponse> GetBotGatewayAsync(RequestOptions options = null)
  251. {
  252. options = RequestOptions.CreateOrClone(options);
  253. return await SendAsync<GetBotGatewayResponse>("GET", () => "gateway/bot", new BucketIds(), options: options).ConfigureAwait(false);
  254. }
  255. #endregion
  256. #region Channels
  257. public async Task<Channel> GetChannelAsync(ulong channelId, RequestOptions options = null)
  258. {
  259. Preconditions.NotEqual(channelId, 0, nameof(channelId));
  260. options = RequestOptions.CreateOrClone(options);
  261. try
  262. {
  263. var ids = new BucketIds(channelId: channelId);
  264. return await SendAsync<Channel>("GET", () => $"channels/{channelId}", ids, options: options).ConfigureAwait(false);
  265. }
  266. catch (HttpException ex) when (ex.HttpCode == HttpStatusCode.NotFound) { return null; }
  267. }
  268. public async Task<Channel> GetChannelAsync(ulong guildId, ulong channelId, RequestOptions options = null)
  269. {
  270. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  271. Preconditions.NotEqual(channelId, 0, nameof(channelId));
  272. options = RequestOptions.CreateOrClone(options);
  273. try
  274. {
  275. var ids = new BucketIds(channelId: channelId);
  276. var model = await SendAsync<Channel>("GET", () => $"channels/{channelId}", ids, options: options).ConfigureAwait(false);
  277. if (!model.GuildId.IsSpecified || model.GuildId.Value != guildId)
  278. return null;
  279. return model;
  280. }
  281. catch (HttpException ex) when (ex.HttpCode == HttpStatusCode.NotFound) { return null; }
  282. }
  283. public async Task<IReadOnlyCollection<Channel>> GetGuildChannelsAsync(ulong guildId, RequestOptions options = null)
  284. {
  285. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  286. options = RequestOptions.CreateOrClone(options);
  287. var ids = new BucketIds(guildId: guildId);
  288. return await SendAsync<IReadOnlyCollection<Channel>>("GET", () => $"guilds/{guildId}/channels", ids, options: options).ConfigureAwait(false);
  289. }
  290. public async Task<Channel> CreateGuildChannelAsync(ulong guildId, CreateGuildChannelParams args, RequestOptions options = null)
  291. {
  292. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  293. Preconditions.NotNull(args, nameof(args));
  294. Preconditions.GreaterThan(args.Bitrate, 0, nameof(args.Bitrate));
  295. Preconditions.NotNullOrWhitespace(args.Name, nameof(args.Name));
  296. Preconditions.LessThan(args.Name.Length, 100, nameof(args.Name));
  297. if (args.Topic.IsSpecified)
  298. Preconditions.LessThan(args.Topic.Value.Length, 1024, nameof(args.Name));
  299. options = RequestOptions.CreateOrClone(options);
  300. var ids = new BucketIds(guildId: guildId);
  301. return await SendJsonAsync<Channel>("POST", () => $"guilds/{guildId}/channels", args, ids, options: options).ConfigureAwait(false);
  302. }
  303. public async Task<Channel> DeleteChannelAsync(ulong channelId, RequestOptions options = null)
  304. {
  305. Preconditions.NotEqual(channelId, 0, nameof(channelId));
  306. options = RequestOptions.CreateOrClone(options);
  307. var ids = new BucketIds(channelId: channelId);
  308. return await SendAsync<Channel>("DELETE", () => $"channels/{channelId}", ids, options: options).ConfigureAwait(false);
  309. }
  310. /// <exception cref="ArgumentException">
  311. /// <paramref name="channelId"/> must not be equal to zero.
  312. /// -and-
  313. /// <paramref name="args.Position"/> must be greater than zero.
  314. /// </exception>
  315. /// <exception cref="ArgumentNullException">
  316. /// <paramref name="args"/> must not be <see langword="null"/>.
  317. /// -and-
  318. /// <paramref name="args.Name"/> must not be <see langword="null"/> or empty.
  319. /// </exception>
  320. public async Task<Channel> ModifyGuildChannelAsync(ulong channelId, Rest.ModifyGuildChannelParams args, RequestOptions options = null)
  321. {
  322. Preconditions.NotEqual(channelId, 0, nameof(channelId));
  323. Preconditions.NotNull(args, nameof(args));
  324. Preconditions.AtLeast(args.Position, 0, nameof(args.Position));
  325. Preconditions.NotNullOrWhitespace(args.Name, nameof(args.Name));
  326. if(args.Name.IsSpecified)
  327. Preconditions.LessThan(args.Name.Value.Length, 100, nameof(args.Name));
  328. options = RequestOptions.CreateOrClone(options);
  329. var ids = new BucketIds(channelId: channelId);
  330. return await SendJsonAsync<Channel>("PATCH", () => $"channels/{channelId}", args, ids, options: options).ConfigureAwait(false);
  331. }
  332. public async Task<Channel> ModifyGuildChannelAsync(ulong channelId, Rest.ModifyTextChannelParams args, RequestOptions options = null)
  333. {
  334. Preconditions.NotEqual(channelId, 0, nameof(channelId));
  335. Preconditions.NotNull(args, nameof(args));
  336. Preconditions.AtLeast(args.Position, 0, nameof(args.Position));
  337. Preconditions.NotNullOrWhitespace(args.Name, nameof(args.Name));
  338. if(args.Name.IsSpecified)
  339. Preconditions.LessThan(args.Name.Value.Length, 100, nameof(args.Name));
  340. if(args.Topic.IsSpecified)
  341. Preconditions.LessThan(args.Topic.Value.Length, 1024, nameof(args.Name));
  342. Preconditions.AtLeast(args.SlowModeInterval, 0, nameof(args.SlowModeInterval));
  343. Preconditions.AtMost(args.SlowModeInterval, 21600, nameof(args.SlowModeInterval));
  344. options = RequestOptions.CreateOrClone(options);
  345. var ids = new BucketIds(channelId: channelId);
  346. return await SendJsonAsync<Channel>("PATCH", () => $"channels/{channelId}", args, ids, options: options).ConfigureAwait(false);
  347. }
  348. public async Task<Channel> ModifyGuildChannelAsync(ulong channelId, Rest.ModifyVoiceChannelParams args, RequestOptions options = null)
  349. {
  350. Preconditions.NotEqual(channelId, 0, nameof(channelId));
  351. Preconditions.NotNull(args, nameof(args));
  352. Preconditions.AtLeast(args.Bitrate, 8000, nameof(args.Bitrate));
  353. Preconditions.AtLeast(args.UserLimit, 0, nameof(args.UserLimit));
  354. Preconditions.AtLeast(args.Position, 0, nameof(args.Position));
  355. Preconditions.NotNullOrWhitespace(args.Name, nameof(args.Name));
  356. options = RequestOptions.CreateOrClone(options);
  357. var ids = new BucketIds(channelId: channelId);
  358. return await SendJsonAsync<Channel>("PATCH", () => $"channels/{channelId}", args, ids, options: options).ConfigureAwait(false);
  359. }
  360. public async Task ModifyGuildChannelsAsync(ulong guildId, IEnumerable<Rest.ModifyGuildChannelsParams> args, RequestOptions options = null)
  361. {
  362. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  363. Preconditions.NotNull(args, nameof(args));
  364. options = RequestOptions.CreateOrClone(options);
  365. var channels = args.ToArray();
  366. switch (channels.Length)
  367. {
  368. case 0:
  369. return;
  370. case 1:
  371. await ModifyGuildChannelAsync(channels[0].Id, new Rest.ModifyGuildChannelParams { Position = channels[0].Position }).ConfigureAwait(false);
  372. break;
  373. default:
  374. var ids = new BucketIds(guildId: guildId);
  375. await SendJsonAsync("PATCH", () => $"guilds/{guildId}/channels", channels, ids, options: options).ConfigureAwait(false);
  376. break;
  377. }
  378. }
  379. #endregion
  380. #region Threads
  381. public async Task<Channel> ModifyThreadAsync(ulong channelId, ModifyThreadParams args, RequestOptions options = null)
  382. {
  383. Preconditions.NotEqual(channelId, 0, nameof(channelId));
  384. var bucket = new BucketIds(channelId: channelId);
  385. return await SendJsonAsync<Channel>("PATCH", () => $"channels/{channelId}", args, bucket, options: options);
  386. }
  387. public async Task<Channel> StartThreadAsync(ulong channelId, ulong messageId, StartThreadParams args, RequestOptions options = null)
  388. {
  389. Preconditions.NotEqual(channelId, 0, nameof(channelId));
  390. Preconditions.NotEqual(messageId, 0, nameof(messageId));
  391. options = RequestOptions.CreateOrClone(options);
  392. var bucket = new BucketIds(0, channelId);
  393. return await SendJsonAsync<Channel>("POST", () => $"channels/{channelId}/messages/{messageId}/threads", args, bucket, options: options).ConfigureAwait(false);
  394. }
  395. public async Task<Channel> StartThreadAsync(ulong channelId, StartThreadParams args, RequestOptions options = null)
  396. {
  397. Preconditions.NotEqual(channelId, 0, nameof(channelId));
  398. options = RequestOptions.CreateOrClone(options);
  399. var bucket = new BucketIds(channelId: channelId);
  400. return await SendJsonAsync<Channel>("POST", () => $"channels/{channelId}/threads", args, bucket, options: options).ConfigureAwait(false);
  401. }
  402. public async Task JoinThreadAsync(ulong channelId, RequestOptions options = null)
  403. {
  404. Preconditions.NotEqual(channelId, 0, nameof(channelId));
  405. options = RequestOptions.CreateOrClone(options);
  406. var bucket = new BucketIds(channelId: channelId);
  407. await SendAsync("PUT", () => $"channels/{channelId}/thread-members/@me", bucket, options: options).ConfigureAwait(false);
  408. }
  409. public async Task AddThreadMemberAsync(ulong channelId, ulong userId, RequestOptions options = null)
  410. {
  411. Preconditions.NotEqual(channelId, 0, nameof(channelId));
  412. Preconditions.NotEqual(userId, 0, nameof(channelId));
  413. options = RequestOptions.CreateOrClone(options);
  414. var bucket = new BucketIds(channelId: channelId);
  415. await SendAsync("PUT", () => $"channels/{channelId}/thread-members/{userId}", bucket, options: options).ConfigureAwait(false);
  416. }
  417. public async Task LeaveThreadAsync(ulong channelId, RequestOptions options = null)
  418. {
  419. Preconditions.NotEqual(channelId, 0, nameof(channelId));
  420. options = RequestOptions.CreateOrClone(options);
  421. var bucket = new BucketIds(channelId: channelId);
  422. await SendAsync("DELETE", () => $"channels/{channelId}/thread-members/@me", bucket, options: options).ConfigureAwait(false);
  423. }
  424. public async Task RemoveThreadMemberAsync(ulong channelId, ulong userId, RequestOptions options = null)
  425. {
  426. Preconditions.NotEqual(channelId, 0, nameof(channelId));
  427. Preconditions.NotEqual(userId, 0, nameof(channelId));
  428. options = RequestOptions.CreateOrClone(options);
  429. var bucket = new BucketIds(channelId: channelId);
  430. await SendAsync("DELETE", () => $"channels/{channelId}/thread-members/{userId}", bucket, options: options).ConfigureAwait(false);
  431. }
  432. public async Task<ThreadMember[]> ListThreadMembersAsync(ulong channelId, RequestOptions options = null)
  433. {
  434. Preconditions.NotEqual(channelId, 0, nameof(channelId));
  435. options = RequestOptions.CreateOrClone(options);
  436. var bucket = new BucketIds(channelId: channelId);
  437. return await SendAsync<ThreadMember[]>("GET", () => $"channels/{channelId}/thread-members", bucket, options: options).ConfigureAwait(false);
  438. }
  439. public async Task<ThreadMember> GetThreadMemberAsync(ulong channelId, ulong userId, RequestOptions options = null)
  440. {
  441. Preconditions.NotEqual(channelId, 0, nameof(channelId));
  442. Preconditions.NotEqual(userId, 0, nameof(userId));
  443. options = RequestOptions.CreateOrClone(options);
  444. var bucket = new BucketIds(channelId: channelId);
  445. return await SendAsync<ThreadMember>("GET", () => $"channels/{channelId}/thread-members/{userId}", bucket, options: options).ConfigureAwait(false);
  446. }
  447. public async Task<ChannelThreads> GetActiveThreadsAsync(ulong channelId, RequestOptions options = null)
  448. {
  449. Preconditions.NotEqual(channelId, 0, nameof(channelId));
  450. options = RequestOptions.CreateOrClone(options);
  451. var bucket = new BucketIds(channelId: channelId);
  452. return await SendAsync<ChannelThreads>("GET", () => $"channels/{channelId}/threads/active", bucket, options: options);
  453. }
  454. public async Task<ChannelThreads> GetPublicArchivedThreadsAsync(ulong channelId, DateTimeOffset? before = null, int? limit = null, RequestOptions options = null)
  455. {
  456. Preconditions.NotEqual(channelId, 0, nameof(channelId));
  457. options = RequestOptions.CreateOrClone(options);
  458. var bucket = new BucketIds(channelId: channelId);
  459. string query = "";
  460. if (limit.HasValue)
  461. {
  462. query = $"?before={before.GetValueOrDefault(DateTimeOffset.UtcNow).ToString("O")}&limit={limit.Value}";
  463. }
  464. else if (before.HasValue)
  465. {
  466. query = $"?before={before.Value.ToString("O")}";
  467. }
  468. return await SendAsync<ChannelThreads>("GET", () => $"channels/{channelId}/threads/archived/public{query}", bucket, options: options);
  469. }
  470. public async Task<ChannelThreads> GetPrivateArchivedThreadsAsync(ulong channelId, DateTimeOffset? before = null, int? limit = null,
  471. RequestOptions options = null)
  472. {
  473. Preconditions.NotEqual(channelId, 0, nameof(channelId));
  474. options = RequestOptions.CreateOrClone(options);
  475. var bucket = new BucketIds(channelId: channelId);
  476. string query = "";
  477. if (limit.HasValue)
  478. {
  479. query = $"?before={before.GetValueOrDefault(DateTimeOffset.UtcNow).ToString("O")}&limit={limit.Value}";
  480. }
  481. else if (before.HasValue)
  482. {
  483. query = $"?before={before.Value.ToString("O")}";
  484. }
  485. return await SendAsync<ChannelThreads>("GET", () => $"channels/{channelId}/threads/archived/private{query}", bucket, options: options);
  486. }
  487. public async Task<ChannelThreads> GetJoinedPrivateArchivedThreadsAsync(ulong channelId, DateTimeOffset? before = null, int? limit = null,
  488. RequestOptions options = null)
  489. {
  490. Preconditions.NotEqual(channelId, 0, nameof(channelId));
  491. options = RequestOptions.CreateOrClone(options);
  492. var bucket = new BucketIds(channelId: channelId);
  493. string query = "";
  494. if (limit.HasValue)
  495. {
  496. query = $"?before={SnowflakeUtils.ToSnowflake(before.GetValueOrDefault(DateTimeOffset.UtcNow))}&limit={limit.Value}";
  497. }
  498. else if (before.HasValue)
  499. {
  500. query = $"?before={before.Value.ToString("O")}";
  501. }
  502. return await SendAsync<ChannelThreads>("GET", () => $"channels/{channelId}/users/@me/threads/archived/private{query}", bucket, options: options);
  503. }
  504. #endregion
  505. #region Stage
  506. public async Task<StageInstance> CreateStageInstanceAsync(CreateStageInstanceParams args, RequestOptions options = null)
  507. {
  508. options = RequestOptions.CreateOrClone(options);
  509. var bucket = new BucketIds();
  510. return await SendJsonAsync<StageInstance>("POST", () => $"stage-instances", args, bucket, options: options).ConfigureAwait(false);
  511. }
  512. public async Task<StageInstance> ModifyStageInstanceAsync(ulong channelId, ModifyStageInstanceParams args, RequestOptions options = null)
  513. {
  514. Preconditions.NotEqual(channelId, 0, nameof(channelId));
  515. options = RequestOptions.CreateOrClone(options);
  516. var bucket = new BucketIds(channelId: channelId);
  517. return await SendJsonAsync<StageInstance>("PATCH", () => $"stage-instances/{channelId}", args, bucket, options: options).ConfigureAwait(false);
  518. }
  519. public async Task DeleteStageInstanceAsync(ulong channelId, RequestOptions options = null)
  520. {
  521. Preconditions.NotEqual(channelId, 0, nameof(channelId));
  522. options = RequestOptions.CreateOrClone(options);
  523. try
  524. {
  525. await SendAsync("DELETE", $"stage-instances/{channelId}", options: options).ConfigureAwait(false);
  526. }
  527. catch (HttpException httpEx) when (httpEx.HttpCode == HttpStatusCode.NotFound) { }
  528. }
  529. public async Task<StageInstance> GetStageInstanceAsync(ulong channelId, RequestOptions options = null)
  530. {
  531. Preconditions.NotEqual(channelId, 0, nameof(channelId));
  532. options = RequestOptions.CreateOrClone(options);
  533. var bucket = new BucketIds(channelId: channelId);
  534. try
  535. {
  536. return await SendAsync<StageInstance>("POST", () => $"stage-instances/{channelId}", bucket, options: options).ConfigureAwait(false);
  537. }
  538. catch (HttpException httpEx) when (httpEx.HttpCode == HttpStatusCode.NotFound)
  539. {
  540. return null;
  541. }
  542. }
  543. public async Task ModifyMyVoiceState(ulong guildId, ModifyVoiceStateParams args, RequestOptions options = null)
  544. {
  545. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  546. options = RequestOptions.CreateOrClone(options);
  547. var bucket = new BucketIds();
  548. await SendJsonAsync("PATCH", () => $"guilds/{guildId}/voice-states/@me", args, bucket, options: options).ConfigureAwait(false);
  549. }
  550. public async Task ModifyUserVoiceState(ulong guildId, ulong userId, ModifyVoiceStateParams args, RequestOptions options = null)
  551. {
  552. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  553. Preconditions.NotEqual(userId, 0, nameof(userId));
  554. options = RequestOptions.CreateOrClone(options);
  555. var bucket = new BucketIds();
  556. await SendJsonAsync("PATCH", () => $"guilds/{guildId}/voice-states/{userId}", args, bucket, options: options).ConfigureAwait(false);
  557. }
  558. #endregion
  559. #region Roles
  560. public async Task AddRoleAsync(ulong guildId, ulong userId, ulong roleId, RequestOptions options = null)
  561. {
  562. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  563. Preconditions.NotEqual(userId, 0, nameof(userId));
  564. Preconditions.NotEqual(roleId, 0, nameof(roleId));
  565. Preconditions.NotEqual(roleId, guildId, nameof(roleId), "The Everyone role cannot be added to a user.");
  566. options = RequestOptions.CreateOrClone(options);
  567. var ids = new BucketIds(guildId: guildId);
  568. await SendAsync("PUT", () => $"guilds/{guildId}/members/{userId}/roles/{roleId}", ids, options: options).ConfigureAwait(false);
  569. }
  570. public async Task RemoveRoleAsync(ulong guildId, ulong userId, ulong roleId, RequestOptions options = null)
  571. {
  572. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  573. Preconditions.NotEqual(userId, 0, nameof(userId));
  574. Preconditions.NotEqual(roleId, 0, nameof(roleId));
  575. Preconditions.NotEqual(roleId, guildId, nameof(roleId), "The Everyone role cannot be removed from a user.");
  576. options = RequestOptions.CreateOrClone(options);
  577. var ids = new BucketIds(guildId: guildId);
  578. await SendAsync("DELETE", () => $"guilds/{guildId}/members/{userId}/roles/{roleId}", ids, options: options).ConfigureAwait(false);
  579. }
  580. #endregion
  581. #region Channel Messages
  582. public async Task<Message> GetChannelMessageAsync(ulong channelId, ulong messageId, RequestOptions options = null)
  583. {
  584. Preconditions.NotEqual(channelId, 0, nameof(channelId));
  585. Preconditions.NotEqual(messageId, 0, nameof(messageId));
  586. options = RequestOptions.CreateOrClone(options);
  587. try
  588. {
  589. var ids = new BucketIds(channelId: channelId);
  590. return await SendAsync<Message>("GET", () => $"channels/{channelId}/messages/{messageId}", ids, options: options).ConfigureAwait(false);
  591. }
  592. catch (HttpException ex) when (ex.HttpCode == HttpStatusCode.NotFound) { return null; }
  593. }
  594. public async Task<IReadOnlyCollection<Message>> GetChannelMessagesAsync(ulong channelId, GetChannelMessagesParams args, RequestOptions options = null)
  595. {
  596. Preconditions.NotEqual(channelId, 0, nameof(channelId));
  597. Preconditions.NotNull(args, nameof(args));
  598. Preconditions.AtLeast(args.Limit, 0, nameof(args.Limit));
  599. Preconditions.AtMost(args.Limit, DiscordConfig.MaxMessagesPerBatch, nameof(args.Limit));
  600. options = RequestOptions.CreateOrClone(options);
  601. int limit = args.Limit.GetValueOrDefault(DiscordConfig.MaxMessagesPerBatch);
  602. ulong? relativeId = args.RelativeMessageId.IsSpecified ? args.RelativeMessageId.Value : (ulong?)null;
  603. var relativeDir = args.RelativeDirection.GetValueOrDefault(Direction.Before) switch
  604. {
  605. Direction.After => "after",
  606. Direction.Around => "around",
  607. _ => "before",
  608. };
  609. var ids = new BucketIds(channelId: channelId);
  610. Expression<Func<string>> endpoint;
  611. if (relativeId != null)
  612. endpoint = () => $"channels/{channelId}/messages?limit={limit}&{relativeDir}={relativeId}";
  613. else
  614. endpoint = () => $"channels/{channelId}/messages?limit={limit}";
  615. return await SendAsync<IReadOnlyCollection<Message>>("GET", endpoint, ids, options: options).ConfigureAwait(false);
  616. }
  617. /// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception>
  618. public async Task<Message> CreateMessageAsync(ulong channelId, CreateMessageParams args, RequestOptions options = null)
  619. {
  620. Preconditions.NotNull(args, nameof(args));
  621. Preconditions.NotEqual(channelId, 0, nameof(channelId));
  622. if ((!args.Embeds.IsSpecified || args.Embeds.Value == null || args.Embeds.Value.Length == 0) && (!args.Stickers.IsSpecified || args.Stickers.Value == null || args.Stickers.Value.Length == 0))
  623. Preconditions.NotNullOrEmpty(args.Content, nameof(args.Content));
  624. if (args.Content?.Length > DiscordConfig.MaxMessageSize)
  625. throw new ArgumentException(message: $"Message content is too long, length must be less or equal to {DiscordConfig.MaxMessageSize}.", paramName: nameof(args.Content));
  626. options = RequestOptions.CreateOrClone(options);
  627. var ids = new BucketIds(channelId: channelId);
  628. return await SendJsonAsync<Message>("POST", () => $"channels/{channelId}/messages", args, ids, clientBucket: ClientBucketType.SendEdit, options: options).ConfigureAwait(false);
  629. }
  630. /// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception>
  631. /// <exception cref="InvalidOperationException">This operation may only be called with a <see cref="TokenType.Webhook"/> token.</exception>
  632. public async Task<Message> CreateWebhookMessageAsync(ulong webhookId, CreateWebhookMessageParams args, RequestOptions options = null)
  633. {
  634. if (AuthTokenType != TokenType.Webhook)
  635. throw new InvalidOperationException($"This operation may only be called with a {nameof(TokenType.Webhook)} token.");
  636. Preconditions.NotNull(args, nameof(args));
  637. Preconditions.NotEqual(webhookId, 0, nameof(webhookId));
  638. if (!args.Embeds.IsSpecified || args.Embeds.Value == null || args.Embeds.Value.Length == 0)
  639. Preconditions.NotNullOrEmpty(args.Content, nameof(args.Content));
  640. if (args.Content?.Length > DiscordConfig.MaxMessageSize)
  641. throw new ArgumentException(message: $"Message content is too long, length must be less or equal to {DiscordConfig.MaxMessageSize}.", paramName: nameof(args.Content));
  642. options = RequestOptions.CreateOrClone(options);
  643. var ids = new BucketIds(webhookId: webhookId);
  644. return await SendJsonAsync<Message>("POST", () => $"webhooks/{webhookId}/{AuthToken}?wait=true", args, ids, clientBucket: ClientBucketType.SendEdit, options: options).ConfigureAwait(false);
  645. }
  646. /// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception>
  647. /// <exception cref="InvalidOperationException">This operation may only be called with a <see cref="TokenType.Webhook"/> token.</exception>
  648. public async Task ModifyWebhookMessageAsync(ulong webhookId, ulong messageId, ModifyWebhookMessageParams args, RequestOptions options = null)
  649. {
  650. if (AuthTokenType != TokenType.Webhook)
  651. throw new InvalidOperationException($"This operation may only be called with a {nameof(TokenType.Webhook)} token.");
  652. Preconditions.NotNull(args, nameof(args));
  653. Preconditions.NotEqual(webhookId, 0, nameof(webhookId));
  654. Preconditions.NotEqual(messageId, 0, nameof(messageId));
  655. if (args.Embeds.IsSpecified)
  656. Preconditions.AtMost(args.Embeds.Value.Length, 10, nameof(args.Embeds), "A max of 10 Embeds are allowed.");
  657. if (args.Content.IsSpecified && args.Content.Value.Length > DiscordConfig.MaxMessageSize)
  658. throw new ArgumentException(message: $"Message content is too long, length must be less or equal to {DiscordConfig.MaxMessageSize}.", paramName: nameof(args.Content));
  659. options = RequestOptions.CreateOrClone(options);
  660. var ids = new BucketIds(webhookId: webhookId);
  661. await SendJsonAsync<Message>("PATCH", () => $"webhooks/{webhookId}/{AuthToken}/messages/{messageId}", args, ids, clientBucket: ClientBucketType.SendEdit, options: options).ConfigureAwait(false);
  662. }
  663. /// <exception cref="InvalidOperationException">This operation may only be called with a <see cref="TokenType.Webhook"/> token.</exception>
  664. public async Task DeleteWebhookMessageAsync(ulong webhookId, ulong messageId, RequestOptions options = null)
  665. {
  666. if (AuthTokenType != TokenType.Webhook)
  667. throw new InvalidOperationException($"This operation may only be called with a {nameof(TokenType.Webhook)} token.");
  668. Preconditions.NotEqual(webhookId, 0, nameof(webhookId));
  669. Preconditions.NotEqual(messageId, 0, nameof(messageId));
  670. options = RequestOptions.CreateOrClone(options);
  671. var ids = new BucketIds(webhookId: webhookId);
  672. await SendAsync("DELETE", () => $"webhooks/{webhookId}/{AuthToken}/messages/{messageId}", ids, options: options).ConfigureAwait(false);
  673. }
  674. /// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception>
  675. public async Task<Message> UploadFileAsync(ulong channelId, UploadFileParams args, RequestOptions options = null)
  676. {
  677. Preconditions.NotNull(args, nameof(args));
  678. Preconditions.NotEqual(channelId, 0, nameof(channelId));
  679. options = RequestOptions.CreateOrClone(options);
  680. if (args.Content.GetValueOrDefault(null) == null)
  681. args.Content = "";
  682. else if (args.Content.IsSpecified && args.Content.Value?.Length > DiscordConfig.MaxMessageSize)
  683. throw new ArgumentOutOfRangeException($"Message content is too long, length must be less or equal to {DiscordConfig.MaxMessageSize}.", nameof(args.Content));
  684. var ids = new BucketIds(channelId: channelId);
  685. return await SendMultipartAsync<Message>("POST", () => $"channels/{channelId}/messages", args.ToDictionary(), ids, clientBucket: ClientBucketType.SendEdit, options: options).ConfigureAwait(false);
  686. }
  687. /// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception>
  688. /// <exception cref="InvalidOperationException">This operation may only be called with a <see cref="TokenType.Webhook"/> token.</exception>
  689. public async Task<Message> UploadWebhookFileAsync(ulong webhookId, UploadWebhookFileParams args, RequestOptions options = null)
  690. {
  691. if (AuthTokenType != TokenType.Webhook)
  692. throw new InvalidOperationException($"This operation may only be called with a {nameof(TokenType.Webhook)} token.");
  693. Preconditions.NotNull(args, nameof(args));
  694. Preconditions.NotEqual(webhookId, 0, nameof(webhookId));
  695. options = RequestOptions.CreateOrClone(options);
  696. if (args.Content.GetValueOrDefault(null) == null)
  697. args.Content = "";
  698. else if (args.Content.IsSpecified)
  699. {
  700. if (args.Content.Value == null)
  701. args.Content = "";
  702. if (args.Content.Value?.Length > DiscordConfig.MaxMessageSize)
  703. throw new ArgumentOutOfRangeException($"Message content is too long, length must be less or equal to {DiscordConfig.MaxMessageSize}.", nameof(args.Content));
  704. }
  705. var ids = new BucketIds(webhookId: webhookId);
  706. return await SendMultipartAsync<Message>("POST", () => $"webhooks/{webhookId}/{AuthToken}?wait=true", args.ToDictionary(), ids, clientBucket: ClientBucketType.SendEdit, options: options).ConfigureAwait(false);
  707. }
  708. public async Task DeleteMessageAsync(ulong channelId, ulong messageId, RequestOptions options = null)
  709. {
  710. Preconditions.NotEqual(channelId, 0, nameof(channelId));
  711. Preconditions.NotEqual(messageId, 0, nameof(messageId));
  712. options = RequestOptions.CreateOrClone(options);
  713. var ids = new BucketIds(channelId: channelId);
  714. await SendAsync("DELETE", () => $"channels/{channelId}/messages/{messageId}", ids, options: options).ConfigureAwait(false);
  715. }
  716. public async Task DeleteMessagesAsync(ulong channelId, DeleteMessagesParams args, RequestOptions options = null)
  717. {
  718. Preconditions.NotEqual(channelId, 0, nameof(channelId));
  719. Preconditions.NotNull(args, nameof(args));
  720. Preconditions.NotNull(args.MessageIds, nameof(args.MessageIds));
  721. Preconditions.AtMost(args.MessageIds.Length, 100, nameof(args.MessageIds.Length));
  722. Preconditions.YoungerThanTwoWeeks(args.MessageIds, nameof(args.MessageIds));
  723. options = RequestOptions.CreateOrClone(options);
  724. switch (args.MessageIds.Length)
  725. {
  726. case 0:
  727. return;
  728. case 1:
  729. await DeleteMessageAsync(channelId, args.MessageIds[0]).ConfigureAwait(false);
  730. break;
  731. default:
  732. var ids = new BucketIds(channelId: channelId);
  733. await SendJsonAsync("POST", () => $"channels/{channelId}/messages/bulk-delete", args, ids, options: options).ConfigureAwait(false);
  734. break;
  735. }
  736. }
  737. /// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception>
  738. public async Task<Message> ModifyMessageAsync(ulong channelId, ulong messageId, Rest.ModifyMessageParams args, RequestOptions options = null)
  739. {
  740. Preconditions.NotEqual(channelId, 0, nameof(channelId));
  741. Preconditions.NotEqual(messageId, 0, nameof(messageId));
  742. Preconditions.NotNull(args, nameof(args));
  743. if (args.Content.IsSpecified && args.Content.Value?.Length > DiscordConfig.MaxMessageSize)
  744. throw new ArgumentOutOfRangeException($"Message content is too long, length must be less or equal to {DiscordConfig.MaxMessageSize}.", nameof(args.Content));
  745. options = RequestOptions.CreateOrClone(options);
  746. var ids = new BucketIds(channelId: channelId);
  747. return await SendJsonAsync<Message>("PATCH", () => $"channels/{channelId}/messages/{messageId}", args, ids, clientBucket: ClientBucketType.SendEdit, options: options).ConfigureAwait(false);
  748. }
  749. public async Task<Message> ModifyMessageAsync(ulong channelId, ulong messageId, Rest.UploadFileParams args, RequestOptions options = null)
  750. {
  751. Preconditions.NotEqual(channelId, 0, nameof(channelId));
  752. Preconditions.NotEqual(messageId, 0, nameof(messageId));
  753. Preconditions.NotNull(args, nameof(args));
  754. if (args.Content.IsSpecified && args.Content.Value?.Length > DiscordConfig.MaxMessageSize)
  755. throw new ArgumentOutOfRangeException($"Message content is too long, length must be less or equal to {DiscordConfig.MaxMessageSize}.", nameof(args.Content));
  756. options = RequestOptions.CreateOrClone(options);
  757. var ids = new BucketIds(channelId: channelId);
  758. return await SendMultipartAsync<Message>("PATCH", () => $"channels/{channelId}/messages/{messageId}", args.ToDictionary(), ids, clientBucket: ClientBucketType.SendEdit, options: options).ConfigureAwait(false);
  759. }
  760. #endregion
  761. #region Stickers, Reactions, Crosspost, and Acks
  762. public async Task<Sticker> GetStickerAsync(ulong id, RequestOptions options = null)
  763. {
  764. Preconditions.NotEqual(id, 0, nameof(id));
  765. options = RequestOptions.CreateOrClone(options);
  766. return await NullifyNotFound(SendAsync<Sticker>("GET", () => $"stickers/{id}", new BucketIds(), options: options)).ConfigureAwait(false);
  767. }
  768. public async Task<Sticker> GetGuildStickerAsync(ulong guildId, ulong id, RequestOptions options = null)
  769. {
  770. Preconditions.NotEqual(id, 0, nameof(id));
  771. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  772. options = RequestOptions.CreateOrClone(options);
  773. return await NullifyNotFound(SendAsync<Sticker>("GET", () => $"guilds/{guildId}/stickers/{id}", new BucketIds(guildId), options: options)).ConfigureAwait(false);
  774. }
  775. public async Task<Sticker[]> ListGuildStickersAsync(ulong guildId, RequestOptions options = null)
  776. {
  777. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  778. options = RequestOptions.CreateOrClone(options);
  779. return await SendAsync<Sticker[]>("GET", () => $"guilds/{guildId}/stickers", new BucketIds(guildId), options: options).ConfigureAwait(false);
  780. }
  781. public async Task<NitroStickerPacks> ListNitroStickerPacksAsync(RequestOptions options = null)
  782. {
  783. options = RequestOptions.CreateOrClone(options);
  784. return await SendAsync<NitroStickerPacks>("GET", () => $"sticker-packs", new BucketIds(), options: options).ConfigureAwait(false);
  785. }
  786. public async Task<Sticker> CreateGuildStickerAsync(CreateStickerParams args, ulong guildId, RequestOptions options = null)
  787. {
  788. Preconditions.NotNull(args, nameof(args));
  789. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  790. options = RequestOptions.CreateOrClone(options);
  791. return await SendMultipartAsync<Sticker>("POST", () => $"guilds/{guildId}/stickers", args.ToDictionary(), new BucketIds(guildId), options: options).ConfigureAwait(false);
  792. }
  793. public async Task<Sticker> ModifyStickerAsync(ModifyStickerParams args, ulong guildId, ulong stickerId, RequestOptions options = null)
  794. {
  795. Preconditions.NotNull(args, nameof(args));
  796. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  797. Preconditions.NotEqual(stickerId, 0, nameof(stickerId));
  798. options = RequestOptions.CreateOrClone(options);
  799. return await SendJsonAsync<Sticker>("PATCH", () => $"guilds/{guildId}/stickers/{stickerId}", args, new BucketIds(guildId), options: options).ConfigureAwait(false);
  800. }
  801. public async Task DeleteStickerAsync(ulong guildId, ulong stickerId, RequestOptions options = null)
  802. {
  803. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  804. Preconditions.NotEqual(stickerId, 0, nameof(stickerId));
  805. options = RequestOptions.CreateOrClone(options);
  806. await SendAsync("DELETE", () => $"guilds/{guildId}/stickers/{stickerId}", new BucketIds(guildId), options: options).ConfigureAwait(false);
  807. }
  808. public async Task AddReactionAsync(ulong channelId, ulong messageId, string emoji, RequestOptions options = null)
  809. {
  810. Preconditions.NotEqual(channelId, 0, nameof(channelId));
  811. Preconditions.NotEqual(messageId, 0, nameof(messageId));
  812. Preconditions.NotNullOrWhitespace(emoji, nameof(emoji));
  813. options = RequestOptions.CreateOrClone(options);
  814. options.IsReactionBucket = true;
  815. var ids = new BucketIds(channelId: channelId);
  816. // @me is non-const to fool the ratelimiter, otherwise it will put add/remove in separate buckets
  817. var me = "@me";
  818. await SendAsync("PUT", () => $"channels/{channelId}/messages/{messageId}/reactions/{emoji}/{me}", ids, options: options).ConfigureAwait(false);
  819. }
  820. public async Task RemoveReactionAsync(ulong channelId, ulong messageId, ulong userId, string emoji, RequestOptions options = null)
  821. {
  822. Preconditions.NotEqual(channelId, 0, nameof(channelId));
  823. Preconditions.NotEqual(messageId, 0, nameof(messageId));
  824. Preconditions.NotNullOrWhitespace(emoji, nameof(emoji));
  825. options = RequestOptions.CreateOrClone(options);
  826. options.IsReactionBucket = true;
  827. var ids = new BucketIds(channelId: channelId);
  828. var user = CurrentUserId.HasValue ? (userId == CurrentUserId.Value ? "@me" : userId.ToString()) : userId.ToString();
  829. await SendAsync("DELETE", () => $"channels/{channelId}/messages/{messageId}/reactions/{emoji}/{user}", ids, options: options).ConfigureAwait(false);
  830. }
  831. public async Task RemoveAllReactionsAsync(ulong channelId, ulong messageId, RequestOptions options = null)
  832. {
  833. Preconditions.NotEqual(channelId, 0, nameof(channelId));
  834. Preconditions.NotEqual(messageId, 0, nameof(messageId));
  835. options = RequestOptions.CreateOrClone(options);
  836. var ids = new BucketIds(channelId: channelId);
  837. await SendAsync("DELETE", () => $"channels/{channelId}/messages/{messageId}/reactions", ids, options: options).ConfigureAwait(false);
  838. }
  839. public async Task RemoveAllReactionsForEmoteAsync(ulong channelId, ulong messageId, string emoji, RequestOptions options = null)
  840. {
  841. Preconditions.NotEqual(channelId, 0, nameof(channelId));
  842. Preconditions.NotEqual(messageId, 0, nameof(messageId));
  843. Preconditions.NotNullOrWhitespace(emoji, nameof(emoji));
  844. options = RequestOptions.CreateOrClone(options);
  845. var ids = new BucketIds(channelId: channelId);
  846. await SendAsync("DELETE", () => $"channels/{channelId}/messages/{messageId}/reactions/{emoji}", ids, options: options).ConfigureAwait(false);
  847. }
  848. public async Task<IReadOnlyCollection<User>> GetReactionUsersAsync(ulong channelId, ulong messageId, string emoji, GetReactionUsersParams args, RequestOptions options = null)
  849. {
  850. Preconditions.NotEqual(channelId, 0, nameof(channelId));
  851. Preconditions.NotEqual(messageId, 0, nameof(messageId));
  852. Preconditions.NotNullOrWhitespace(emoji, nameof(emoji));
  853. Preconditions.NotNull(args, nameof(args));
  854. Preconditions.GreaterThan(args.Limit, 0, nameof(args.Limit));
  855. Preconditions.AtMost(args.Limit, DiscordConfig.MaxUserReactionsPerBatch, nameof(args.Limit));
  856. Preconditions.GreaterThan(args.AfterUserId, 0, nameof(args.AfterUserId));
  857. options = RequestOptions.CreateOrClone(options);
  858. int limit = args.Limit.GetValueOrDefault(DiscordConfig.MaxUserReactionsPerBatch);
  859. ulong afterUserId = args.AfterUserId.GetValueOrDefault(0);
  860. var ids = new BucketIds(channelId: channelId);
  861. Expression<Func<string>> endpoint = () => $"channels/{channelId}/messages/{messageId}/reactions/{emoji}?limit={limit}&after={afterUserId}";
  862. return await SendAsync<IReadOnlyCollection<User>>("GET", endpoint, ids, options: options).ConfigureAwait(false);
  863. }
  864. public async Task AckMessageAsync(ulong channelId, ulong messageId, RequestOptions options = null)
  865. {
  866. Preconditions.NotEqual(channelId, 0, nameof(channelId));
  867. Preconditions.NotEqual(messageId, 0, nameof(messageId));
  868. options = RequestOptions.CreateOrClone(options);
  869. var ids = new BucketIds(channelId: channelId);
  870. await SendAsync("POST", () => $"channels/{channelId}/messages/{messageId}/ack", ids, options: options).ConfigureAwait(false);
  871. }
  872. public async Task TriggerTypingIndicatorAsync(ulong channelId, RequestOptions options = null)
  873. {
  874. Preconditions.NotEqual(channelId, 0, nameof(channelId));
  875. options = RequestOptions.CreateOrClone(options);
  876. var ids = new BucketIds(channelId: channelId);
  877. await SendAsync("POST", () => $"channels/{channelId}/typing", ids, options: options).ConfigureAwait(false);
  878. }
  879. public async Task CrosspostAsync(ulong channelId, ulong messageId, RequestOptions options = null)
  880. {
  881. Preconditions.NotEqual(channelId, 0, nameof(channelId));
  882. Preconditions.NotEqual(messageId, 0, nameof(messageId));
  883. options = RequestOptions.CreateOrClone(options);
  884. var ids = new BucketIds(channelId: channelId);
  885. await SendAsync("POST", () => $"channels/{channelId}/messages/{messageId}/crosspost", ids, options: options).ConfigureAwait(false);
  886. }
  887. #endregion
  888. #region Channel Permissions
  889. public async Task ModifyChannelPermissionsAsync(ulong channelId, ulong targetId, ModifyChannelPermissionsParams args, RequestOptions options = null)
  890. {
  891. Preconditions.NotEqual(channelId, 0, nameof(channelId));
  892. Preconditions.NotEqual(targetId, 0, nameof(targetId));
  893. Preconditions.NotNull(args, nameof(args));
  894. options = RequestOptions.CreateOrClone(options);
  895. var ids = new BucketIds(channelId: channelId);
  896. await SendJsonAsync("PUT", () => $"channels/{channelId}/permissions/{targetId}", args, ids, options: options).ConfigureAwait(false);
  897. }
  898. public async Task DeleteChannelPermissionAsync(ulong channelId, ulong targetId, RequestOptions options = null)
  899. {
  900. Preconditions.NotEqual(channelId, 0, nameof(channelId));
  901. Preconditions.NotEqual(targetId, 0, nameof(targetId));
  902. options = RequestOptions.CreateOrClone(options);
  903. var ids = new BucketIds(channelId: channelId);
  904. await SendAsync("DELETE", () => $"channels/{channelId}/permissions/{targetId}", ids, options: options).ConfigureAwait(false);
  905. }
  906. #endregion
  907. #region Channel Pins
  908. public async Task AddPinAsync(ulong channelId, ulong messageId, RequestOptions options = null)
  909. {
  910. Preconditions.GreaterThan(channelId, 0, nameof(channelId));
  911. Preconditions.GreaterThan(messageId, 0, nameof(messageId));
  912. options = RequestOptions.CreateOrClone(options);
  913. var ids = new BucketIds(channelId: channelId);
  914. await SendAsync("PUT", () => $"channels/{channelId}/pins/{messageId}", ids, options: options).ConfigureAwait(false);
  915. }
  916. public async Task RemovePinAsync(ulong channelId, ulong messageId, RequestOptions options = null)
  917. {
  918. Preconditions.NotEqual(channelId, 0, nameof(channelId));
  919. Preconditions.NotEqual(messageId, 0, nameof(messageId));
  920. options = RequestOptions.CreateOrClone(options);
  921. var ids = new BucketIds(channelId: channelId);
  922. await SendAsync("DELETE", () => $"channels/{channelId}/pins/{messageId}", ids, options: options).ConfigureAwait(false);
  923. }
  924. public async Task<IReadOnlyCollection<Message>> GetPinsAsync(ulong channelId, RequestOptions options = null)
  925. {
  926. Preconditions.NotEqual(channelId, 0, nameof(channelId));
  927. options = RequestOptions.CreateOrClone(options);
  928. var ids = new BucketIds(channelId: channelId);
  929. return await SendAsync<IReadOnlyCollection<Message>>("GET", () => $"channels/{channelId}/pins", ids, options: options).ConfigureAwait(false);
  930. }
  931. #endregion
  932. #region Channel Recipients
  933. public async Task AddGroupRecipientAsync(ulong channelId, ulong userId, RequestOptions options = null)
  934. {
  935. Preconditions.GreaterThan(channelId, 0, nameof(channelId));
  936. Preconditions.GreaterThan(userId, 0, nameof(userId));
  937. options = RequestOptions.CreateOrClone(options);
  938. var ids = new BucketIds(channelId: channelId);
  939. await SendAsync("PUT", () => $"channels/{channelId}/recipients/{userId}", ids, options: options).ConfigureAwait(false);
  940. }
  941. public async Task RemoveGroupRecipientAsync(ulong channelId, ulong userId, RequestOptions options = null)
  942. {
  943. Preconditions.NotEqual(channelId, 0, nameof(channelId));
  944. Preconditions.NotEqual(userId, 0, nameof(userId));
  945. options = RequestOptions.CreateOrClone(options);
  946. var ids = new BucketIds(channelId: channelId);
  947. await SendAsync("DELETE", () => $"channels/{channelId}/recipients/{userId}", ids, options: options).ConfigureAwait(false);
  948. }
  949. #endregion
  950. #region Interactions
  951. public async Task<ApplicationCommand[]> GetGlobalApplicationCommandsAsync(RequestOptions options = null)
  952. {
  953. options = RequestOptions.CreateOrClone(options);
  954. return await SendAsync<ApplicationCommand[]>("GET", () => $"applications/{CurrentUserId}/commands", new BucketIds(), options: options).ConfigureAwait(false);
  955. }
  956. public async Task<ApplicationCommand> GetGlobalApplicationCommandAsync(ulong id, RequestOptions options = null)
  957. {
  958. Preconditions.NotEqual(id, 0, nameof(id));
  959. options = RequestOptions.CreateOrClone(options);
  960. try
  961. {
  962. return await SendAsync<ApplicationCommand>("GET", () => $"applications/{CurrentUserId}/commands/{id}", new BucketIds(), options: options).ConfigureAwait(false);
  963. }
  964. catch (HttpException x) when (x.HttpCode == HttpStatusCode.NotFound) { return null; }
  965. }
  966. public async Task<ApplicationCommand> CreateGlobalApplicationCommandAsync(CreateApplicationCommandParams command, RequestOptions options = null)
  967. {
  968. Preconditions.NotNull(command, nameof(command));
  969. Preconditions.AtMost(command.Name.Length, 32, nameof(command.Name));
  970. Preconditions.AtLeast(command.Name.Length, 3, nameof(command.Name));
  971. if (command.Type == ApplicationCommandType.Slash)
  972. {
  973. Preconditions.NotNullOrEmpty(command.Description, nameof(command.Description));
  974. Preconditions.AtMost(command.Description.Length, 100, nameof(command.Description));
  975. Preconditions.AtLeast(command.Description.Length, 1, nameof(command.Description));
  976. }
  977. options = RequestOptions.CreateOrClone(options);
  978. return await TrySendApplicationCommandAsync(SendJsonAsync<ApplicationCommand>("POST", () => $"applications/{CurrentUserId}/commands", command, new BucketIds(), options: options)).ConfigureAwait(false);
  979. }
  980. public async Task<ApplicationCommand> ModifyGlobalApplicationCommandAsync(ModifyApplicationCommandParams command, ulong commandId, RequestOptions options = null)
  981. {
  982. options = RequestOptions.CreateOrClone(options);
  983. return await TrySendApplicationCommandAsync(SendJsonAsync<ApplicationCommand>("PATCH", () => $"applications/{CurrentUserId}/commands/{commandId}", command, new BucketIds(), options: options)).ConfigureAwait(false);
  984. }
  985. public async Task<ApplicationCommand> ModifyGlobalApplicationUserCommandAsync(ModifyApplicationCommandParams command, ulong commandId, RequestOptions options = null)
  986. {
  987. options = RequestOptions.CreateOrClone(options);
  988. return await TrySendApplicationCommandAsync(SendJsonAsync<ApplicationCommand>("PATCH", () => $"applications/{CurrentUserId}/commands/{commandId}", command, new BucketIds(), options: options)).ConfigureAwait(false);
  989. }
  990. public async Task<ApplicationCommand> ModifyGlobalApplicationMessageCommandAsync(ModifyApplicationCommandParams command, ulong commandId, RequestOptions options = null)
  991. {
  992. options = RequestOptions.CreateOrClone(options);
  993. return await TrySendApplicationCommandAsync(SendJsonAsync<ApplicationCommand>("PATCH", () => $"applications/{CurrentUserId}/commands/{commandId}", command, new BucketIds(), options: options)).ConfigureAwait(false);
  994. }
  995. public async Task DeleteGlobalApplicationCommandAsync(ulong commandId, RequestOptions options = null)
  996. {
  997. options = RequestOptions.CreateOrClone(options);
  998. await SendAsync("DELETE", () => $"applications/{CurrentUserId}/commands/{commandId}", new BucketIds(), options: options).ConfigureAwait(false);
  999. }
  1000. public async Task<ApplicationCommand[]> BulkOverwriteGlobalApplicationCommandsAsync(CreateApplicationCommandParams[] commands, RequestOptions options = null)
  1001. {
  1002. options = RequestOptions.CreateOrClone(options);
  1003. return await TrySendApplicationCommandAsync(SendJsonAsync<ApplicationCommand[]>("PUT", () => $"applications/{CurrentUserId}/commands", commands, new BucketIds(), options: options)).ConfigureAwait(false);
  1004. }
  1005. public async Task<ApplicationCommand[]> GetGuildApplicationCommandsAsync(ulong guildId, RequestOptions options = null)
  1006. {
  1007. options = RequestOptions.CreateOrClone(options);
  1008. var bucket = new BucketIds(guildId: guildId);
  1009. return await SendAsync<ApplicationCommand[]>("GET", () => $"applications/{CurrentUserId}/guilds/{guildId}/commands", bucket, options: options).ConfigureAwait(false);
  1010. }
  1011. public async Task<ApplicationCommand> GetGuildApplicationCommandAsync(ulong guildId, ulong commandId, RequestOptions options = null)
  1012. {
  1013. options = RequestOptions.CreateOrClone(options);
  1014. var bucket = new BucketIds(guildId: guildId);
  1015. try
  1016. {
  1017. return await SendAsync<ApplicationCommand>("GET", () => $"applications/{CurrentUserId}/guilds/{guildId}/commands/{commandId}", bucket, options: options);
  1018. }
  1019. catch (HttpException x) when (x.HttpCode == HttpStatusCode.NotFound) { return null; }
  1020. }
  1021. public async Task<ApplicationCommand> CreateGuildApplicationCommandAsync(CreateApplicationCommandParams command, ulong guildId, RequestOptions options = null)
  1022. {
  1023. Preconditions.NotNull(command, nameof(command));
  1024. Preconditions.AtMost(command.Name.Length, 32, nameof(command.Name));
  1025. Preconditions.AtLeast(command.Name.Length, 3, nameof(command.Name));
  1026. if (command.Type == ApplicationCommandType.Slash)
  1027. {
  1028. Preconditions.NotNullOrEmpty(command.Description, nameof(command.Description));
  1029. Preconditions.AtMost(command.Description.Length, 100, nameof(command.Description));
  1030. Preconditions.AtLeast(command.Description.Length, 1, nameof(command.Description));
  1031. }
  1032. options = RequestOptions.CreateOrClone(options);
  1033. var bucket = new BucketIds(guildId: guildId);
  1034. return await TrySendApplicationCommandAsync(SendJsonAsync<ApplicationCommand>("POST", () => $"applications/{CurrentUserId}/guilds/{guildId}/commands", command, bucket, options: options)).ConfigureAwait(false);
  1035. }
  1036. public async Task<ApplicationCommand> ModifyGuildApplicationCommandAsync(ModifyApplicationCommandParams command, ulong guildId, ulong commandId, RequestOptions options = null)
  1037. {
  1038. options = RequestOptions.CreateOrClone(options);
  1039. var bucket = new BucketIds(guildId: guildId);
  1040. return await TrySendApplicationCommandAsync(SendJsonAsync<ApplicationCommand>("PATCH", () => $"applications/{CurrentUserId}/guilds/{guildId}/commands/{commandId}", command, bucket, options: options)).ConfigureAwait(false);
  1041. }
  1042. public async Task DeleteGuildApplicationCommandAsync(ulong guildId, ulong commandId, RequestOptions options = null)
  1043. {
  1044. options = RequestOptions.CreateOrClone(options);
  1045. var bucket = new BucketIds(guildId: guildId);
  1046. await SendAsync<ApplicationCommand>("DELETE", () => $"applications/{CurrentUserId}/guilds/{guildId}/commands/{commandId}", bucket, options: options).ConfigureAwait(false);
  1047. }
  1048. public async Task<ApplicationCommand[]> BulkOverwriteGuildApplicationCommandsAsync(ulong guildId, CreateApplicationCommandParams[] commands, RequestOptions options = null)
  1049. {
  1050. options = RequestOptions.CreateOrClone(options);
  1051. var bucket = new BucketIds(guildId: guildId);
  1052. return await TrySendApplicationCommandAsync(SendJsonAsync<ApplicationCommand[]>("PUT", () => $"applications/{CurrentUserId}/guilds/{guildId}/commands", commands, bucket, options: options)).ConfigureAwait(false);
  1053. }
  1054. #endregion
  1055. #region Interaction Responses
  1056. public async Task CreateInteractionResponseAsync(InteractionResponse response, ulong interactionId, string interactionToken, RequestOptions options = null)
  1057. {
  1058. if (response.Data.IsSpecified && response.Data.Value.Content.IsSpecified)
  1059. Preconditions.AtMost(response.Data.Value.Content.Value?.Length ?? 0, 2000, nameof(response.Data.Value.Content));
  1060. options = RequestOptions.CreateOrClone(options);
  1061. await SendJsonAsync<Message>("POST", () => $"interactions/{interactionId}/{interactionToken}/callback", response, new BucketIds(), options: options);
  1062. }
  1063. public async Task<Message> GetInteractionResponseAsync(string interactionToken, RequestOptions options = null)
  1064. {
  1065. Preconditions.NotNullOrEmpty(interactionToken, nameof(interactionToken));
  1066. options = RequestOptions.CreateOrClone(options);
  1067. return await SendAsync<Message>("GET", () => $"webhooks/{CurrentUserId}/{interactionToken}/messages/@original", new BucketIds(), options: options).ConfigureAwait(false);
  1068. }
  1069. public async Task<Message> ModifyInteractionResponseAsync(ModifyInteractionResponseParams args, string interactionToken, RequestOptions options = null)
  1070. {
  1071. options = RequestOptions.CreateOrClone(options);
  1072. return await SendJsonAsync<Message>("PATCH", () => $"webhooks/{CurrentUserId}/{interactionToken}/messages/@original", args, new BucketIds(), options: options);
  1073. }
  1074. public async Task DeleteInteractionResponseAsync(string interactionToken, RequestOptions options = null)
  1075. {
  1076. options = RequestOptions.CreateOrClone(options);
  1077. await SendAsync("DELETE", () => $"webhooks/{CurrentUserId}/{interactionToken}/messages/@original", new BucketIds(), options: options);
  1078. }
  1079. public async Task<Message> CreateInteractionFollowupMessageAsync(CreateWebhookMessageParams args, string token, RequestOptions options = null)
  1080. {
  1081. if ((!args.Embeds.IsSpecified || args.Embeds.Value == null || args.Embeds.Value.Length == 0) && !args.File.IsSpecified)
  1082. Preconditions.NotNullOrEmpty(args.Content, nameof(args.Content));
  1083. if (args.Content?.Length > DiscordConfig.MaxMessageSize)
  1084. throw new ArgumentException(message: $"Message content is too long, length must be less or equal to {DiscordConfig.MaxMessageSize}.", paramName: nameof(args.Content));
  1085. options = RequestOptions.CreateOrClone(options);
  1086. if (!args.File.IsSpecified)
  1087. return await SendJsonAsync<Message>("POST", () => $"webhooks/{CurrentUserId}/{token}?wait=true", args, new BucketIds(), options: options).ConfigureAwait(false);
  1088. else
  1089. return await SendMultipartAsync<Message>("POST", () => $"webhooks/{CurrentUserId}/{token}?wait=true", args.ToDictionary(), new BucketIds(), options: options).ConfigureAwait(false);
  1090. }
  1091. public async Task<Message> ModifyInteractionFollowupMessageAsync(ModifyInteractionResponseParams args, ulong id, string token, RequestOptions options = null)
  1092. {
  1093. Preconditions.NotNull(args, nameof(args));
  1094. Preconditions.NotEqual(id, 0, nameof(id));
  1095. if (args.Content.IsSpecified)
  1096. if (args.Content.Value.Length > DiscordConfig.MaxMessageSize)
  1097. throw new ArgumentException(message: $"Message content is too long, length must be less or equal to {DiscordConfig.MaxMessageSize}.", paramName: nameof(args.Content));
  1098. options = RequestOptions.CreateOrClone(options);
  1099. return await SendJsonAsync<Message>("PATCH", () => $"webhooks/{CurrentUserId}/{token}/messages/{id}", args, new BucketIds(), options: options).ConfigureAwait(false);
  1100. }
  1101. public async Task DeleteInteractionFollowupMessageAsync(ulong id, string token, RequestOptions options = null)
  1102. {
  1103. Preconditions.NotEqual(id, 0, nameof(id));
  1104. options = RequestOptions.CreateOrClone(options);
  1105. await SendAsync("DELETE", () => $"webhooks/{CurrentUserId}/{token}/messages/{id}", new BucketIds(), options: options).ConfigureAwait(false);
  1106. }
  1107. #endregion
  1108. #region Application Command permissions
  1109. public async Task<GuildApplicationCommandPermission[]> GetGuildApplicationCommandPermissionsAsync(ulong guildId, RequestOptions options = null)
  1110. {
  1111. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  1112. options = RequestOptions.CreateOrClone(options);
  1113. return await SendAsync<GuildApplicationCommandPermission[]>("GET", () => $"applications/{CurrentUserId}/guilds/{guildId}/commands/permissions", new BucketIds(), options: options).ConfigureAwait(false);
  1114. }
  1115. public async Task<GuildApplicationCommandPermission> GetGuildApplicationCommandPermissionAsync(ulong guildId, ulong commandId, RequestOptions options = null)
  1116. {
  1117. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  1118. Preconditions.NotEqual(commandId, 0, nameof(commandId));
  1119. options = RequestOptions.CreateOrClone(options);
  1120. return await SendAsync<GuildApplicationCommandPermission>("GET", () => $"applications/{CurrentUserId}/guilds/{guildId}/commands/{commandId}/permissions", new BucketIds(), options: options).ConfigureAwait(false);
  1121. }
  1122. public async Task<GuildApplicationCommandPermission> ModifyApplicationCommandPermissionsAsync(ModifyGuildApplicationCommandPermissionsParams permissions, ulong guildId, ulong commandId, RequestOptions options = null)
  1123. {
  1124. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  1125. Preconditions.NotEqual(commandId, 0, nameof(commandId));
  1126. options = RequestOptions.CreateOrClone(options);
  1127. return await SendJsonAsync<GuildApplicationCommandPermission>("PUT", () => $"applications/{CurrentUserId}/guilds/{guildId}/commands/{commandId}/permissions", permissions, new BucketIds(), options: options).ConfigureAwait(false);
  1128. }
  1129. public async Task<IReadOnlyCollection<GuildApplicationCommandPermission>> BatchModifyApplicationCommandPermissionsAsync(ModifyGuildApplicationCommandPermissions[] permissions, ulong guildId, RequestOptions options = null)
  1130. {
  1131. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  1132. Preconditions.NotNull(permissions, nameof(permissions));
  1133. options = RequestOptions.CreateOrClone(options);
  1134. return await SendJsonAsync<GuildApplicationCommandPermission[]>("PUT", () => $"applications/{CurrentUserId}/guilds/{guildId}/commands/permissions", permissions, new BucketIds(), options: options).ConfigureAwait(false);
  1135. }
  1136. #endregion
  1137. #region Guilds
  1138. public async Task<Guild> GetGuildAsync(ulong guildId, bool withCounts, RequestOptions options = null)
  1139. {
  1140. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  1141. options = RequestOptions.CreateOrClone(options);
  1142. try
  1143. {
  1144. var ids = new BucketIds(guildId: guildId);
  1145. return await SendAsync<Guild>("GET", () => $"guilds/{guildId}?with_counts={(withCounts ? "true" : "false")}", ids, options: options).ConfigureAwait(false);
  1146. }
  1147. catch (HttpException ex) when (ex.HttpCode == HttpStatusCode.NotFound) { return null; }
  1148. }
  1149. public async Task<Guild> CreateGuildAsync(CreateGuildParams args, RequestOptions options = null)
  1150. {
  1151. Preconditions.NotNull(args, nameof(args));
  1152. Preconditions.NotNullOrWhitespace(args.Name, nameof(args.Name));
  1153. Preconditions.NotNullOrWhitespace(args.RegionId, nameof(args.RegionId));
  1154. options = RequestOptions.CreateOrClone(options);
  1155. return await SendJsonAsync<Guild>("POST", () => "guilds", args, new BucketIds(), options: options).ConfigureAwait(false);
  1156. }
  1157. public async Task<Guild> DeleteGuildAsync(ulong guildId, RequestOptions options = null)
  1158. {
  1159. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  1160. options = RequestOptions.CreateOrClone(options);
  1161. var ids = new BucketIds(guildId: guildId);
  1162. return await SendAsync<Guild>("DELETE", () => $"guilds/{guildId}", ids, options: options).ConfigureAwait(false);
  1163. }
  1164. public async Task<Guild> LeaveGuildAsync(ulong guildId, RequestOptions options = null)
  1165. {
  1166. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  1167. options = RequestOptions.CreateOrClone(options);
  1168. var ids = new BucketIds(guildId: guildId);
  1169. return await SendAsync<Guild>("DELETE", () => $"users/@me/guilds/{guildId}", ids, options: options).ConfigureAwait(false);
  1170. }
  1171. public async Task<Guild> ModifyGuildAsync(ulong guildId, Rest.ModifyGuildParams args, RequestOptions options = null)
  1172. {
  1173. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  1174. Preconditions.NotNull(args, nameof(args));
  1175. Preconditions.NotEqual(args.AfkChannelId, 0, nameof(args.AfkChannelId));
  1176. Preconditions.AtLeast(args.AfkTimeout, 0, nameof(args.AfkTimeout));
  1177. Preconditions.NotNullOrEmpty(args.Name, nameof(args.Name));
  1178. Preconditions.GreaterThan(args.OwnerId, 0, nameof(args.OwnerId));
  1179. Preconditions.NotNull(args.RegionId, nameof(args.RegionId));
  1180. options = RequestOptions.CreateOrClone(options);
  1181. var ids = new BucketIds(guildId: guildId);
  1182. return await SendJsonAsync<Guild>("PATCH", () => $"guilds/{guildId}", args, ids, options: options).ConfigureAwait(false);
  1183. }
  1184. public async Task<GetGuildPruneCountResponse> BeginGuildPruneAsync(ulong guildId, GuildPruneParams args, RequestOptions options = null)
  1185. {
  1186. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  1187. Preconditions.NotNull(args, nameof(args));
  1188. Preconditions.AtLeast(args.Days, 1, nameof(args.Days));
  1189. options = RequestOptions.CreateOrClone(options);
  1190. var ids = new BucketIds(guildId: guildId);
  1191. return await SendJsonAsync<GetGuildPruneCountResponse>("POST", () => $"guilds/{guildId}/prune", args, ids, options: options).ConfigureAwait(false);
  1192. }
  1193. public async Task<GetGuildPruneCountResponse> GetGuildPruneCountAsync(ulong guildId, GuildPruneParams args, RequestOptions options = null)
  1194. {
  1195. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  1196. Preconditions.NotNull(args, nameof(args));
  1197. Preconditions.AtLeast(args.Days, 1, nameof(args.Days));
  1198. string endpointRoleIds = args.IncludeRoleIds?.Length > 0 ? $"&include_roles={string.Join(",", args.IncludeRoleIds)}" : "";
  1199. options = RequestOptions.CreateOrClone(options);
  1200. var ids = new BucketIds(guildId: guildId);
  1201. return await SendAsync<GetGuildPruneCountResponse>("GET", () => $"guilds/{guildId}/prune?days={args.Days}{endpointRoleIds}", ids, options: options).ConfigureAwait(false);
  1202. }
  1203. #endregion
  1204. #region Guild Bans
  1205. public async Task<IReadOnlyCollection<Ban>> GetGuildBansAsync(ulong guildId, RequestOptions options = null)
  1206. {
  1207. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  1208. options = RequestOptions.CreateOrClone(options);
  1209. var ids = new BucketIds(guildId: guildId);
  1210. return await SendAsync<IReadOnlyCollection<Ban>>("GET", () => $"guilds/{guildId}/bans", ids, options: options).ConfigureAwait(false);
  1211. }
  1212. public async Task<Ban> GetGuildBanAsync(ulong guildId, ulong userId, RequestOptions options)
  1213. {
  1214. Preconditions.NotEqual(userId, 0, nameof(userId));
  1215. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  1216. options = RequestOptions.CreateOrClone(options);
  1217. try
  1218. {
  1219. var ids = new BucketIds(guildId: guildId);
  1220. return await SendAsync<Ban>("GET", () => $"guilds/{guildId}/bans/{userId}", ids, options: options).ConfigureAwait(false);
  1221. }
  1222. catch (HttpException ex) when (ex.HttpCode == HttpStatusCode.NotFound) { return null; }
  1223. }
  1224. /// <exception cref="ArgumentException">
  1225. /// <paramref name="guildId"/> and <paramref name="userId"/> must not be equal to zero.
  1226. /// -and-
  1227. /// <paramref name="args.DeleteMessageDays"/> must be between 0 to 7.
  1228. /// </exception>
  1229. /// <exception cref="ArgumentNullException"><paramref name="args"/> must not be <see langword="null"/>.</exception>
  1230. public async Task CreateGuildBanAsync(ulong guildId, ulong userId, CreateGuildBanParams args, RequestOptions options = null)
  1231. {
  1232. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  1233. Preconditions.NotEqual(userId, 0, nameof(userId));
  1234. Preconditions.NotNull(args, nameof(args));
  1235. Preconditions.AtLeast(args.DeleteMessageDays, 0, nameof(args.DeleteMessageDays), "Prune length must be within [0, 7]");
  1236. Preconditions.AtMost(args.DeleteMessageDays, 7, nameof(args.DeleteMessageDays), "Prune length must be within [0, 7]");
  1237. options = RequestOptions.CreateOrClone(options);
  1238. var ids = new BucketIds(guildId: guildId);
  1239. string reason = string.IsNullOrWhiteSpace(args.Reason) ? "" : $"&reason={Uri.EscapeDataString(args.Reason)}";
  1240. await SendAsync("PUT", () => $"guilds/{guildId}/bans/{userId}?delete_message_days={args.DeleteMessageDays}{reason}", ids, options: options).ConfigureAwait(false);
  1241. }
  1242. /// <exception cref="ArgumentException"><paramref name="guildId"/> and <paramref name="userId"/> must not be equal to zero.</exception>
  1243. public async Task RemoveGuildBanAsync(ulong guildId, ulong userId, RequestOptions options = null)
  1244. {
  1245. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  1246. Preconditions.NotEqual(userId, 0, nameof(userId));
  1247. options = RequestOptions.CreateOrClone(options);
  1248. var ids = new BucketIds(guildId: guildId);
  1249. await SendAsync("DELETE", () => $"guilds/{guildId}/bans/{userId}", ids, options: options).ConfigureAwait(false);
  1250. }
  1251. #endregion
  1252. #region Guild Widget
  1253. /// <exception cref="ArgumentException"><paramref name="guildId"/> must not be equal to zero.</exception>
  1254. public async Task<GuildWidget> GetGuildWidgetAsync(ulong guildId, RequestOptions options = null)
  1255. {
  1256. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  1257. options = RequestOptions.CreateOrClone(options);
  1258. try
  1259. {
  1260. var ids = new BucketIds(guildId: guildId);
  1261. return await SendAsync<GuildWidget>("GET", () => $"guilds/{guildId}/widget", ids, options: options).ConfigureAwait(false);
  1262. }
  1263. catch (HttpException ex) when (ex.HttpCode == HttpStatusCode.NotFound) { return null; }
  1264. }
  1265. /// <exception cref="ArgumentException"><paramref name="guildId"/> must not be equal to zero.</exception>
  1266. /// <exception cref="ArgumentNullException"><paramref name="args"/> must not be <see langword="null"/>.</exception>
  1267. public async Task<GuildWidget> ModifyGuildWidgetAsync(ulong guildId, Rest.ModifyGuildWidgetParams args, RequestOptions options = null)
  1268. {
  1269. Preconditions.NotNull(args, nameof(args));
  1270. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  1271. options = RequestOptions.CreateOrClone(options);
  1272. var ids = new BucketIds(guildId: guildId);
  1273. return await SendJsonAsync<GuildWidget>("PATCH", () => $"guilds/{guildId}/widget", args, ids, options: options).ConfigureAwait(false);
  1274. }
  1275. #endregion
  1276. #region Guild Integrations
  1277. /// <exception cref="ArgumentException"><paramref name="guildId"/> must not be equal to zero.</exception>
  1278. public async Task<IReadOnlyCollection<Integration>> GetGuildIntegrationsAsync(ulong guildId, RequestOptions options = null)
  1279. {
  1280. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  1281. options = RequestOptions.CreateOrClone(options);
  1282. var ids = new BucketIds(guildId: guildId);
  1283. return await SendAsync<IReadOnlyCollection<Integration>>("GET", () => $"guilds/{guildId}/integrations", ids, options: options).ConfigureAwait(false);
  1284. }
  1285. /// <exception cref="ArgumentException"><paramref name="guildId"/> and <paramref name="args.Id"/> must not be equal to zero.</exception>
  1286. /// <exception cref="ArgumentNullException"><paramref name="args"/> must not be <see langword="null"/>.</exception>
  1287. public async Task<Integration> CreateGuildIntegrationAsync(ulong guildId, CreateGuildIntegrationParams args, RequestOptions options = null)
  1288. {
  1289. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  1290. Preconditions.NotNull(args, nameof(args));
  1291. Preconditions.NotEqual(args.Id, 0, nameof(args.Id));
  1292. options = RequestOptions.CreateOrClone(options);
  1293. var ids = new BucketIds(guildId: guildId);
  1294. return await SendAsync<Integration>("POST", () => $"guilds/{guildId}/integrations", ids, options: options).ConfigureAwait(false);
  1295. }
  1296. public async Task<Integration> DeleteGuildIntegrationAsync(ulong guildId, ulong integrationId, RequestOptions options = null)
  1297. {
  1298. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  1299. Preconditions.NotEqual(integrationId, 0, nameof(integrationId));
  1300. options = RequestOptions.CreateOrClone(options);
  1301. var ids = new BucketIds(guildId: guildId);
  1302. return await SendAsync<Integration>("DELETE", () => $"guilds/{guildId}/integrations/{integrationId}", ids, options: options).ConfigureAwait(false);
  1303. }
  1304. public async Task<Integration> ModifyGuildIntegrationAsync(ulong guildId, ulong integrationId, Rest.ModifyGuildIntegrationParams args, RequestOptions options = null)
  1305. {
  1306. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  1307. Preconditions.NotEqual(integrationId, 0, nameof(integrationId));
  1308. Preconditions.NotNull(args, nameof(args));
  1309. Preconditions.AtLeast(args.ExpireBehavior, 0, nameof(args.ExpireBehavior));
  1310. Preconditions.AtLeast(args.ExpireGracePeriod, 0, nameof(args.ExpireGracePeriod));
  1311. options = RequestOptions.CreateOrClone(options);
  1312. var ids = new BucketIds(guildId: guildId);
  1313. return await SendJsonAsync<Integration>("PATCH", () => $"guilds/{guildId}/integrations/{integrationId}", args, ids, options: options).ConfigureAwait(false);
  1314. }
  1315. public async Task<Integration> SyncGuildIntegrationAsync(ulong guildId, ulong integrationId, RequestOptions options = null)
  1316. {
  1317. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  1318. Preconditions.NotEqual(integrationId, 0, nameof(integrationId));
  1319. options = RequestOptions.CreateOrClone(options);
  1320. var ids = new BucketIds(guildId: guildId);
  1321. return await SendAsync<Integration>("POST", () => $"guilds/{guildId}/integrations/{integrationId}/sync", ids, options: options).ConfigureAwait(false);
  1322. }
  1323. #endregion
  1324. #region Guild Invites
  1325. /// <exception cref="ArgumentException"><paramref name="inviteId"/> cannot be blank.</exception>
  1326. /// <exception cref="ArgumentNullException"><paramref name="inviteId"/> must not be <see langword="null"/>.</exception>
  1327. public async Task<InviteMetadata> GetInviteAsync(string inviteId, RequestOptions options = null)
  1328. {
  1329. Preconditions.NotNullOrEmpty(inviteId, nameof(inviteId));
  1330. options = RequestOptions.CreateOrClone(options);
  1331. //Remove trailing slash
  1332. if (inviteId[inviteId.Length - 1] == '/')
  1333. inviteId = inviteId.Substring(0, inviteId.Length - 1);
  1334. //Remove leading URL
  1335. int index = inviteId.LastIndexOf('/');
  1336. if (index >= 0)
  1337. inviteId = inviteId.Substring(index + 1);
  1338. try
  1339. {
  1340. return await SendAsync<InviteMetadata>("GET", () => $"invites/{inviteId}?with_counts=true", new BucketIds(), options: options).ConfigureAwait(false);
  1341. }
  1342. catch (HttpException ex) when (ex.HttpCode == HttpStatusCode.NotFound) { return null; }
  1343. }
  1344. /// <exception cref="ArgumentException"><paramref name="guildId"/> may not be equal to zero.</exception>
  1345. public async Task<InviteVanity> GetVanityInviteAsync(ulong guildId, RequestOptions options = null)
  1346. {
  1347. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  1348. options = RequestOptions.CreateOrClone(options);
  1349. var ids = new BucketIds(guildId: guildId);
  1350. return await SendAsync<InviteVanity>("GET", () => $"guilds/{guildId}/vanity-url", ids, options: options).ConfigureAwait(false);
  1351. }
  1352. /// <exception cref="ArgumentException"><paramref name="guildId"/> may not be equal to zero.</exception>
  1353. public async Task<IReadOnlyCollection<InviteMetadata>> GetGuildInvitesAsync(ulong guildId, RequestOptions options = null)
  1354. {
  1355. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  1356. options = RequestOptions.CreateOrClone(options);
  1357. var ids = new BucketIds(guildId: guildId);
  1358. return await SendAsync<IReadOnlyCollection<InviteMetadata>>("GET", () => $"guilds/{guildId}/invites", ids, options: options).ConfigureAwait(false);
  1359. }
  1360. /// <exception cref="ArgumentException"><paramref name="channelId"/> may not be equal to zero.</exception>
  1361. public async Task<IReadOnlyCollection<InviteMetadata>> GetChannelInvitesAsync(ulong channelId, RequestOptions options = null)
  1362. {
  1363. Preconditions.NotEqual(channelId, 0, nameof(channelId));
  1364. options = RequestOptions.CreateOrClone(options);
  1365. var ids = new BucketIds(channelId: channelId);
  1366. return await SendAsync<IReadOnlyCollection<InviteMetadata>>("GET", () => $"channels/{channelId}/invites", ids, options: options).ConfigureAwait(false);
  1367. }
  1368. /// <exception cref="ArgumentException">
  1369. /// <paramref name="channelId"/> may not be equal to zero.
  1370. /// -and-
  1371. /// <paramref name="args.MaxAge"/> and <paramref name="args.MaxUses"/> must be greater than zero.
  1372. /// -and-
  1373. /// <paramref name="args.MaxAge"/> must be lesser than 86400.
  1374. /// </exception>
  1375. /// <exception cref="ArgumentNullException"><paramref name="args"/> must not be <see langword="null"/>.</exception>
  1376. public async Task<InviteMetadata> CreateChannelInviteAsync(ulong channelId, CreateChannelInviteParams args, RequestOptions options = null)
  1377. {
  1378. Preconditions.NotEqual(channelId, 0, nameof(channelId));
  1379. Preconditions.NotNull(args, nameof(args));
  1380. Preconditions.AtLeast(args.MaxAge, 0, nameof(args.MaxAge));
  1381. Preconditions.AtLeast(args.MaxUses, 0, nameof(args.MaxUses));
  1382. Preconditions.AtMost(args.MaxAge, 86400, nameof(args.MaxAge),
  1383. "The maximum age of an invite must be less than or equal to a day (86400 seconds).");
  1384. if (args.TargetType.IsSpecified)
  1385. {
  1386. Preconditions.NotEqual((int)args.TargetType.Value, (int)TargetUserType.Undefined, nameof(args.TargetType));
  1387. if (args.TargetType.Value == TargetUserType.Stream) Preconditions.GreaterThan(args.TargetUserId, 0, nameof(args.TargetUserId));
  1388. if (args.TargetType.Value == TargetUserType.EmbeddedApplication) Preconditions.GreaterThan(args.TargetApplicationId, 0, nameof(args.TargetUserId));
  1389. }
  1390. options = RequestOptions.CreateOrClone(options);
  1391. var ids = new BucketIds(channelId: channelId);
  1392. return await SendJsonAsync<InviteMetadata>("POST", () => $"channels/{channelId}/invites", args, ids, options: options).ConfigureAwait(false);
  1393. }
  1394. public async Task<Invite> DeleteInviteAsync(string inviteId, RequestOptions options = null)
  1395. {
  1396. Preconditions.NotNullOrEmpty(inviteId, nameof(inviteId));
  1397. options = RequestOptions.CreateOrClone(options);
  1398. return await SendAsync<Invite>("DELETE", () => $"invites/{inviteId}", new BucketIds(), options: options).ConfigureAwait(false);
  1399. }
  1400. #endregion
  1401. #region Guild Members
  1402. public async Task<GuildMember> AddGuildMemberAsync(ulong guildId, ulong userId, AddGuildMemberParams args, RequestOptions options = null)
  1403. {
  1404. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  1405. Preconditions.NotEqual(userId, 0, nameof(userId));
  1406. Preconditions.NotNull(args, nameof(args));
  1407. Preconditions.NotNullOrWhitespace(args.AccessToken, nameof(args.AccessToken));
  1408. if (args.RoleIds.IsSpecified)
  1409. {
  1410. foreach (var roleId in args.RoleIds.Value)
  1411. Preconditions.NotEqual(roleId, 0, nameof(roleId));
  1412. }
  1413. options = RequestOptions.CreateOrClone(options);
  1414. var ids = new BucketIds(guildId: guildId);
  1415. return await SendJsonAsync<GuildMember>("PUT", () => $"guilds/{guildId}/members/{userId}", args, ids, options: options);
  1416. }
  1417. public async Task<GuildMember> GetGuildMemberAsync(ulong guildId, ulong userId, RequestOptions options = null)
  1418. {
  1419. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  1420. Preconditions.NotEqual(userId, 0, nameof(userId));
  1421. options = RequestOptions.CreateOrClone(options);
  1422. try
  1423. {
  1424. var ids = new BucketIds(guildId: guildId);
  1425. return await SendAsync<GuildMember>("GET", () => $"guilds/{guildId}/members/{userId}", ids, options: options).ConfigureAwait(false);
  1426. }
  1427. catch (HttpException ex) when (ex.HttpCode == HttpStatusCode.NotFound) { return null; }
  1428. }
  1429. public async Task<IReadOnlyCollection<GuildMember>> GetGuildMembersAsync(ulong guildId, GetGuildMembersParams args, RequestOptions options = null)
  1430. {
  1431. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  1432. Preconditions.NotNull(args, nameof(args));
  1433. Preconditions.GreaterThan(args.Limit, 0, nameof(args.Limit));
  1434. Preconditions.AtMost(args.Limit, DiscordConfig.MaxUsersPerBatch, nameof(args.Limit));
  1435. Preconditions.GreaterThan(args.AfterUserId, 0, nameof(args.AfterUserId));
  1436. options = RequestOptions.CreateOrClone(options);
  1437. int limit = args.Limit.GetValueOrDefault(int.MaxValue);
  1438. ulong afterUserId = args.AfterUserId.GetValueOrDefault(0);
  1439. var ids = new BucketIds(guildId: guildId);
  1440. Expression<Func<string>> endpoint = () => $"guilds/{guildId}/members?limit={limit}&after={afterUserId}";
  1441. return await SendAsync<IReadOnlyCollection<GuildMember>>("GET", endpoint, ids, options: options).ConfigureAwait(false);
  1442. }
  1443. public async Task RemoveGuildMemberAsync(ulong guildId, ulong userId, string reason, RequestOptions options = null)
  1444. {
  1445. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  1446. Preconditions.NotEqual(userId, 0, nameof(userId));
  1447. options = RequestOptions.CreateOrClone(options);
  1448. var ids = new BucketIds(guildId: guildId);
  1449. reason = string.IsNullOrWhiteSpace(reason) ? "" : $"?reason={Uri.EscapeDataString(reason)}";
  1450. await SendAsync("DELETE", () => $"guilds/{guildId}/members/{userId}{reason}", ids, options: options).ConfigureAwait(false);
  1451. }
  1452. public async Task ModifyGuildMemberAsync(ulong guildId, ulong userId, Rest.ModifyGuildMemberParams args, RequestOptions options = null)
  1453. {
  1454. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  1455. Preconditions.NotEqual(userId, 0, nameof(userId));
  1456. Preconditions.NotNull(args, nameof(args));
  1457. options = RequestOptions.CreateOrClone(options);
  1458. bool isCurrentUser = userId == CurrentUserId;
  1459. if (args.RoleIds.IsSpecified)
  1460. Preconditions.NotEveryoneRole(args.RoleIds.Value, guildId, nameof(args.RoleIds));
  1461. if (isCurrentUser && args.Nickname.IsSpecified)
  1462. {
  1463. var nickArgs = new Rest.ModifyCurrentUserNickParams(args.Nickname.Value ?? "");
  1464. await ModifyMyNickAsync(guildId, nickArgs).ConfigureAwait(false);
  1465. args.Nickname = Optional.Create<string>(); //Remove
  1466. }
  1467. if (!isCurrentUser || args.Deaf.IsSpecified || args.Mute.IsSpecified || args.RoleIds.IsSpecified)
  1468. {
  1469. var ids = new BucketIds(guildId: guildId);
  1470. await SendJsonAsync("PATCH", () => $"guilds/{guildId}/members/{userId}", args, ids, options: options).ConfigureAwait(false);
  1471. }
  1472. }
  1473. public async Task<IReadOnlyCollection<GuildMember>> SearchGuildMembersAsync(ulong guildId, SearchGuildMembersParams args, RequestOptions options = null)
  1474. {
  1475. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  1476. Preconditions.NotNull(args, nameof(args));
  1477. Preconditions.GreaterThan(args.Limit, 0, nameof(args.Limit));
  1478. Preconditions.AtMost(args.Limit, DiscordConfig.MaxUsersPerBatch, nameof(args.Limit));
  1479. Preconditions.NotNullOrEmpty(args.Query, nameof(args.Query));
  1480. options = RequestOptions.CreateOrClone(options);
  1481. int limit = args.Limit.GetValueOrDefault(DiscordConfig.MaxUsersPerBatch);
  1482. string query = args.Query;
  1483. var ids = new BucketIds(guildId: guildId);
  1484. Expression<Func<string>> endpoint = () => $"guilds/{guildId}/members/search?limit={limit}&query={query}";
  1485. return await SendAsync<IReadOnlyCollection<GuildMember>>("GET", endpoint, ids, options: options).ConfigureAwait(false);
  1486. }
  1487. #endregion
  1488. #region Guild Roles
  1489. public async Task<IReadOnlyCollection<Role>> GetGuildRolesAsync(ulong guildId, RequestOptions options = null)
  1490. {
  1491. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  1492. options = RequestOptions.CreateOrClone(options);
  1493. var ids = new BucketIds(guildId: guildId);
  1494. return await SendAsync<IReadOnlyCollection<Role>>("GET", () => $"guilds/{guildId}/roles", ids, options: options).ConfigureAwait(false);
  1495. }
  1496. public async Task<Role> CreateGuildRoleAsync(ulong guildId, Rest.ModifyGuildRoleParams args, RequestOptions options = null)
  1497. {
  1498. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  1499. options = RequestOptions.CreateOrClone(options);
  1500. var ids = new BucketIds(guildId: guildId);
  1501. return await SendJsonAsync<Role>("POST", () => $"guilds/{guildId}/roles", args, ids, options: options).ConfigureAwait(false);
  1502. }
  1503. public async Task DeleteGuildRoleAsync(ulong guildId, ulong roleId, RequestOptions options = null)
  1504. {
  1505. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  1506. Preconditions.NotEqual(roleId, 0, nameof(roleId));
  1507. options = RequestOptions.CreateOrClone(options);
  1508. var ids = new BucketIds(guildId: guildId);
  1509. await SendAsync("DELETE", () => $"guilds/{guildId}/roles/{roleId}", ids, options: options).ConfigureAwait(false);
  1510. }
  1511. public async Task<Role> ModifyGuildRoleAsync(ulong guildId, ulong roleId, Rest.ModifyGuildRoleParams args, RequestOptions options = null)
  1512. {
  1513. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  1514. Preconditions.NotEqual(roleId, 0, nameof(roleId));
  1515. Preconditions.NotNull(args, nameof(args));
  1516. Preconditions.AtLeast(args.Color, 0, nameof(args.Color));
  1517. Preconditions.NotNullOrEmpty(args.Name, nameof(args.Name));
  1518. options = RequestOptions.CreateOrClone(options);
  1519. var ids = new BucketIds(guildId: guildId);
  1520. return await SendJsonAsync<Role>("PATCH", () => $"guilds/{guildId}/roles/{roleId}", args, ids, options: options).ConfigureAwait(false);
  1521. }
  1522. public async Task<IReadOnlyCollection<Role>> ModifyGuildRolesAsync(ulong guildId, IEnumerable<Rest.ModifyGuildRolesParams> args, RequestOptions options = null)
  1523. {
  1524. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  1525. Preconditions.NotNull(args, nameof(args));
  1526. options = RequestOptions.CreateOrClone(options);
  1527. var ids = new BucketIds(guildId: guildId);
  1528. return await SendJsonAsync<IReadOnlyCollection<Role>>("PATCH", () => $"guilds/{guildId}/roles", args, ids, options: options).ConfigureAwait(false);
  1529. }
  1530. #endregion
  1531. #region Guild emoji
  1532. public async Task<IReadOnlyCollection<Emoji>> GetGuildEmotesAsync(ulong guildId, RequestOptions options = null)
  1533. {
  1534. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  1535. options = RequestOptions.CreateOrClone(options);
  1536. var ids = new BucketIds(guildId: guildId);
  1537. return await SendAsync<IReadOnlyCollection<Emoji>>("GET", () => $"guilds/{guildId}/emojis", ids, options: options).ConfigureAwait(false);
  1538. }
  1539. public async Task<Emoji> GetGuildEmoteAsync(ulong guildId, ulong emoteId, RequestOptions options = null)
  1540. {
  1541. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  1542. Preconditions.NotEqual(emoteId, 0, nameof(emoteId));
  1543. options = RequestOptions.CreateOrClone(options);
  1544. var ids = new BucketIds(guildId: guildId);
  1545. return await SendAsync<Emoji>("GET", () => $"guilds/{guildId}/emojis/{emoteId}", ids, options: options).ConfigureAwait(false);
  1546. }
  1547. public async Task<Emoji> CreateGuildEmoteAsync(ulong guildId, Rest.CreateGuildEmoteParams args, RequestOptions options = null)
  1548. {
  1549. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  1550. Preconditions.NotNull(args, nameof(args));
  1551. Preconditions.NotNullOrWhitespace(args.Name, nameof(args.Name));
  1552. Preconditions.NotNull(args.Image.Stream, nameof(args.Image));
  1553. options = RequestOptions.CreateOrClone(options);
  1554. var ids = new BucketIds(guildId: guildId);
  1555. return await SendJsonAsync<Emoji>("POST", () => $"guilds/{guildId}/emojis", args, ids, options: options).ConfigureAwait(false);
  1556. }
  1557. public async Task<Emoji> ModifyGuildEmoteAsync(ulong guildId, ulong emoteId, ModifyGuildEmoteParams args, RequestOptions options = null)
  1558. {
  1559. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  1560. Preconditions.NotEqual(emoteId, 0, nameof(emoteId));
  1561. Preconditions.NotNull(args, nameof(args));
  1562. options = RequestOptions.CreateOrClone(options);
  1563. var ids = new BucketIds(guildId: guildId);
  1564. return await SendJsonAsync<Emoji>("PATCH", () => $"guilds/{guildId}/emojis/{emoteId}", args, ids, options: options).ConfigureAwait(false);
  1565. }
  1566. public async Task DeleteGuildEmoteAsync(ulong guildId, ulong emoteId, RequestOptions options = null)
  1567. {
  1568. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  1569. Preconditions.NotEqual(emoteId, 0, nameof(emoteId));
  1570. options = RequestOptions.CreateOrClone(options);
  1571. var ids = new BucketIds(guildId: guildId);
  1572. await SendAsync("DELETE", () => $"guilds/{guildId}/emojis/{emoteId}", ids, options: options).ConfigureAwait(false);
  1573. }
  1574. #endregion
  1575. #region Guild Events
  1576. public async Task<GuildScheduledEvent[]> ListGuildScheduledEventsAsync(ulong guildId, RequestOptions options = null)
  1577. {
  1578. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  1579. options = RequestOptions.CreateOrClone(options);
  1580. var ids = new BucketIds(guildId: guildId);
  1581. return await SendAsync<GuildScheduledEvent[]>("GET", () => $"guilds/{guildId}/scheduled-events?with_user_count=true", ids, options: options).ConfigureAwait(false);
  1582. }
  1583. public async Task<GuildScheduledEvent> GetGuildScheduledEventAsync(ulong eventId, ulong guildId, RequestOptions options = null)
  1584. {
  1585. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  1586. Preconditions.NotEqual(eventId, 0, nameof(eventId));
  1587. options = RequestOptions.CreateOrClone(options);
  1588. var ids = new BucketIds(guildId: guildId);
  1589. return await NullifyNotFound<GuildScheduledEvent>(SendAsync<GuildScheduledEvent>("GET", () => $"guilds/{guildId}/scheduled-events/{eventId}?with_user_count=true", ids, options: options)).ConfigureAwait(false);
  1590. }
  1591. public async Task<GuildScheduledEvent> CreateGuildScheduledEventAsync(CreateGuildScheduledEventParams args, ulong guildId, RequestOptions options = null)
  1592. {
  1593. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  1594. Preconditions.NotNull(args, nameof(args));
  1595. options = RequestOptions.CreateOrClone(options);
  1596. var ids = new BucketIds(guildId: guildId);
  1597. return await SendJsonAsync<GuildScheduledEvent>("POST", () => $"guilds/{guildId}/scheduled-events", args, ids, options: options).ConfigureAwait(false);
  1598. }
  1599. public async Task<GuildScheduledEvent> ModifyGuildScheduledEventAsync(ModifyGuildScheduledEventParams args, ulong eventId, ulong guildId, RequestOptions options = null)
  1600. {
  1601. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  1602. Preconditions.NotEqual(eventId, 0, nameof(eventId));
  1603. Preconditions.NotNull(args, nameof(args));
  1604. options = RequestOptions.CreateOrClone(options);
  1605. var ids = new BucketIds(guildId: guildId);
  1606. return await SendJsonAsync<GuildScheduledEvent>("PATCH", () => $"guilds/{guildId}/scheduled-events/{eventId}", args, ids, options: options).ConfigureAwait(false);
  1607. }
  1608. public async Task DeleteGuildScheduledEventAsync(ulong eventId, ulong guildId, RequestOptions options = null)
  1609. {
  1610. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  1611. Preconditions.NotEqual(eventId, 0, nameof(eventId));
  1612. options = RequestOptions.CreateOrClone(options);
  1613. var ids = new BucketIds(guildId: guildId);
  1614. await SendAsync("DELETE", () => $"guilds/{guildId}/scheduled-events/{eventId}", ids, options: options).ConfigureAwait(false);
  1615. }
  1616. public async Task<GuildScheduledEventUser[]> GetGuildScheduledEventUsersAsync(ulong eventId, ulong guildId, int limit = 100, RequestOptions options = null)
  1617. {
  1618. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  1619. Preconditions.NotEqual(eventId, 0, nameof(eventId));
  1620. options = RequestOptions.CreateOrClone(options);
  1621. var ids = new BucketIds(guildId: guildId);
  1622. return await SendAsync<GuildScheduledEventUser[]>("GET", () => $"guilds/{guildId}/scheduled-events/{eventId}/users?limit={limit}&with_member=true", ids, options: options).ConfigureAwait(false);
  1623. }
  1624. public async Task<GuildScheduledEventUser[]> GetGuildScheduledEventUsersAsync(ulong eventId, ulong guildId, GetEventUsersParams args, RequestOptions options = null)
  1625. {
  1626. Preconditions.NotEqual(eventId, 0, nameof(eventId));
  1627. Preconditions.NotNull(args, nameof(args));
  1628. Preconditions.AtLeast(args.Limit, 0, nameof(args.Limit));
  1629. Preconditions.AtMost(args.Limit, DiscordConfig.MaxMessagesPerBatch, nameof(args.Limit));
  1630. options = RequestOptions.CreateOrClone(options);
  1631. int limit = args.Limit.GetValueOrDefault(DiscordConfig.MaxGuildEventUsersPerBatch);
  1632. ulong? relativeId = args.RelativeUserId.IsSpecified ? args.RelativeUserId.Value : (ulong?)null;
  1633. var relativeDir = args.RelativeDirection.GetValueOrDefault(Direction.Before) switch
  1634. {
  1635. Direction.After => "after",
  1636. Direction.Around => "around",
  1637. _ => "before",
  1638. };
  1639. var ids = new BucketIds(guildId: guildId);
  1640. Expression<Func<string>> endpoint;
  1641. if (relativeId != null)
  1642. endpoint = () => $"guilds/{guildId}/scheduled-events/{eventId}/users?with_member=true&limit={limit}&{relativeDir}={relativeId}";
  1643. else
  1644. endpoint = () => $"guilds/{guildId}/scheduled-events/{eventId}/users?with_member=true&limit={limit}";
  1645. return await SendAsync<GuildScheduledEventUser[]>("GET", endpoint, ids, options: options).ConfigureAwait(false);
  1646. }
  1647. #endregion
  1648. #region Users
  1649. public async Task<User> GetUserAsync(ulong userId, RequestOptions options = null)
  1650. {
  1651. Preconditions.NotEqual(userId, 0, nameof(userId));
  1652. options = RequestOptions.CreateOrClone(options);
  1653. try
  1654. {
  1655. return await SendAsync<User>("GET", () => $"users/{userId}", new BucketIds(), options: options).ConfigureAwait(false);
  1656. }
  1657. catch (HttpException ex) when (ex.HttpCode == HttpStatusCode.NotFound) { return null; }
  1658. }
  1659. #endregion
  1660. #region Current User/DMs
  1661. public async Task<User> GetMyUserAsync(RequestOptions options = null)
  1662. {
  1663. options = RequestOptions.CreateOrClone(options);
  1664. return await SendAsync<User>("GET", () => "users/@me", new BucketIds(), options: options).ConfigureAwait(false);
  1665. }
  1666. public async Task<IReadOnlyCollection<Connection>> GetMyConnectionsAsync(RequestOptions options = null)
  1667. {
  1668. options = RequestOptions.CreateOrClone(options);
  1669. return await SendAsync<IReadOnlyCollection<Connection>>("GET", () => "users/@me/connections", new BucketIds(), options: options).ConfigureAwait(false);
  1670. }
  1671. public async Task<IReadOnlyCollection<Channel>> GetMyPrivateChannelsAsync(RequestOptions options = null)
  1672. {
  1673. options = RequestOptions.CreateOrClone(options);
  1674. return await SendAsync<IReadOnlyCollection<Channel>>("GET", () => "users/@me/channels", new BucketIds(), options: options).ConfigureAwait(false);
  1675. }
  1676. public async Task<IReadOnlyCollection<UserGuild>> GetMyGuildsAsync(GetGuildSummariesParams args, RequestOptions options = null)
  1677. {
  1678. Preconditions.NotNull(args, nameof(args));
  1679. Preconditions.GreaterThan(args.Limit, 0, nameof(args.Limit));
  1680. Preconditions.AtMost(args.Limit, DiscordConfig.MaxGuildsPerBatch, nameof(args.Limit));
  1681. Preconditions.GreaterThan(args.AfterGuildId, 0, nameof(args.AfterGuildId));
  1682. options = RequestOptions.CreateOrClone(options);
  1683. int limit = args.Limit.GetValueOrDefault(int.MaxValue);
  1684. ulong afterGuildId = args.AfterGuildId.GetValueOrDefault(0);
  1685. return await SendAsync<IReadOnlyCollection<UserGuild>>("GET", () => $"users/@me/guilds?limit={limit}&after={afterGuildId}", new BucketIds(), options: options).ConfigureAwait(false);
  1686. }
  1687. public async Task<Application> GetMyApplicationAsync(RequestOptions options = null)
  1688. {
  1689. options = RequestOptions.CreateOrClone(options);
  1690. return await SendAsync<Application>("GET", () => "oauth2/applications/@me", new BucketIds(), options: options).ConfigureAwait(false);
  1691. }
  1692. public async Task<User> ModifySelfAsync(Rest.ModifyCurrentUserParams args, RequestOptions options = null)
  1693. {
  1694. Preconditions.NotNull(args, nameof(args));
  1695. Preconditions.NotNullOrEmpty(args.Username, nameof(args.Username));
  1696. options = RequestOptions.CreateOrClone(options);
  1697. return await SendJsonAsync<User>("PATCH", () => "users/@me", args, new BucketIds(), options: options).ConfigureAwait(false);
  1698. }
  1699. public async Task ModifyMyNickAsync(ulong guildId, Rest.ModifyCurrentUserNickParams args, RequestOptions options = null)
  1700. {
  1701. Preconditions.NotNull(args, nameof(args));
  1702. Preconditions.NotNull(args.Nickname, nameof(args.Nickname));
  1703. options = RequestOptions.CreateOrClone(options);
  1704. var ids = new BucketIds(guildId: guildId);
  1705. await SendJsonAsync("PATCH", () => $"guilds/{guildId}/members/@me/nick", args, ids, options: options).ConfigureAwait(false);
  1706. }
  1707. public async Task<Channel> CreateDMChannelAsync(CreateDMChannelParams args, RequestOptions options = null)
  1708. {
  1709. Preconditions.NotNull(args, nameof(args));
  1710. Preconditions.GreaterThan(args.RecipientId, 0, nameof(args.RecipientId));
  1711. options = RequestOptions.CreateOrClone(options);
  1712. return await SendJsonAsync<Channel>("POST", () => "users/@me/channels", args, new BucketIds(), options: options).ConfigureAwait(false);
  1713. }
  1714. #endregion
  1715. #region Voice Regions
  1716. public async Task<IReadOnlyCollection<VoiceRegion>> GetVoiceRegionsAsync(RequestOptions options = null)
  1717. {
  1718. options = RequestOptions.CreateOrClone(options);
  1719. return await SendAsync<IReadOnlyCollection<VoiceRegion>>("GET", () => "voice/regions", new BucketIds(), options: options).ConfigureAwait(false);
  1720. }
  1721. public async Task<IReadOnlyCollection<VoiceRegion>> GetGuildVoiceRegionsAsync(ulong guildId, RequestOptions options = null)
  1722. {
  1723. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  1724. options = RequestOptions.CreateOrClone(options);
  1725. var ids = new BucketIds(guildId: guildId);
  1726. return await SendAsync<IReadOnlyCollection<VoiceRegion>>("GET", () => $"guilds/{guildId}/regions", ids, options: options).ConfigureAwait(false);
  1727. }
  1728. #endregion
  1729. #region Audit logs
  1730. public async Task<AuditLog> GetAuditLogsAsync(ulong guildId, GetAuditLogsParams args, RequestOptions options = null)
  1731. {
  1732. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  1733. Preconditions.NotNull(args, nameof(args));
  1734. options = RequestOptions.CreateOrClone(options);
  1735. int limit = args.Limit.GetValueOrDefault(int.MaxValue);
  1736. var ids = new BucketIds(guildId: guildId);
  1737. Expression<Func<string>> endpoint;
  1738. var queryArgs = new StringBuilder();
  1739. if (args.BeforeEntryId.IsSpecified)
  1740. {
  1741. queryArgs.Append("&before=")
  1742. .Append(args.BeforeEntryId);
  1743. }
  1744. if (args.UserId.IsSpecified)
  1745. {
  1746. queryArgs.Append("&user_id=")
  1747. .Append(args.UserId.Value);
  1748. }
  1749. if (args.ActionType.IsSpecified)
  1750. {
  1751. queryArgs.Append("&action_type=")
  1752. .Append(args.ActionType.Value);
  1753. }
  1754. // Still use string interp for the query w/o params, as this is necessary for CreateBucketId
  1755. endpoint = () => $"guilds/{guildId}/audit-logs?limit={limit}{queryArgs.ToString()}";
  1756. return await SendAsync<AuditLog>("GET", endpoint, ids, options: options).ConfigureAwait(false);
  1757. }
  1758. #endregion
  1759. #region Webhooks
  1760. public async Task<Webhook> CreateWebhookAsync(ulong channelId, CreateWebhookParams args, RequestOptions options = null)
  1761. {
  1762. Preconditions.NotEqual(channelId, 0, nameof(channelId));
  1763. Preconditions.NotNull(args, nameof(args));
  1764. Preconditions.NotNull(args.Name, nameof(args.Name));
  1765. options = RequestOptions.CreateOrClone(options);
  1766. var ids = new BucketIds(channelId: channelId);
  1767. return await SendJsonAsync<Webhook>("POST", () => $"channels/{channelId}/webhooks", args, ids, options: options).ConfigureAwait(false);
  1768. }
  1769. public async Task<Webhook> GetWebhookAsync(ulong webhookId, RequestOptions options = null)
  1770. {
  1771. Preconditions.NotEqual(webhookId, 0, nameof(webhookId));
  1772. options = RequestOptions.CreateOrClone(options);
  1773. try
  1774. {
  1775. if (AuthTokenType == TokenType.Webhook)
  1776. return await SendAsync<Webhook>("GET", () => $"webhooks/{webhookId}/{AuthToken}", new BucketIds(), options: options).ConfigureAwait(false);
  1777. else
  1778. return await SendAsync<Webhook>("GET", () => $"webhooks/{webhookId}", new BucketIds(), options: options).ConfigureAwait(false);
  1779. }
  1780. catch (HttpException ex) when (ex.HttpCode == HttpStatusCode.NotFound) { return null; }
  1781. }
  1782. public async Task<Webhook> ModifyWebhookAsync(ulong webhookId, ModifyWebhookParams args, RequestOptions options = null)
  1783. {
  1784. Preconditions.NotEqual(webhookId, 0, nameof(webhookId));
  1785. Preconditions.NotNull(args, nameof(args));
  1786. Preconditions.NotNullOrEmpty(args.Name, nameof(args.Name));
  1787. options = RequestOptions.CreateOrClone(options);
  1788. if (AuthTokenType == TokenType.Webhook)
  1789. return await SendJsonAsync<Webhook>("PATCH", () => $"webhooks/{webhookId}/{AuthToken}", args, new BucketIds(), options: options).ConfigureAwait(false);
  1790. else
  1791. return await SendJsonAsync<Webhook>("PATCH", () => $"webhooks/{webhookId}", args, new BucketIds(), options: options).ConfigureAwait(false);
  1792. }
  1793. public async Task DeleteWebhookAsync(ulong webhookId, RequestOptions options = null)
  1794. {
  1795. Preconditions.NotEqual(webhookId, 0, nameof(webhookId));
  1796. options = RequestOptions.CreateOrClone(options);
  1797. if (AuthTokenType == TokenType.Webhook)
  1798. await SendAsync("DELETE", () => $"webhooks/{webhookId}/{AuthToken}", new BucketIds(), options: options).ConfigureAwait(false);
  1799. else
  1800. await SendAsync("DELETE", () => $"webhooks/{webhookId}", new BucketIds(), options: options).ConfigureAwait(false);
  1801. }
  1802. public async Task<IReadOnlyCollection<Webhook>> GetGuildWebhooksAsync(ulong guildId, RequestOptions options = null)
  1803. {
  1804. Preconditions.NotEqual(guildId, 0, nameof(guildId));
  1805. options = RequestOptions.CreateOrClone(options);
  1806. var ids = new BucketIds(guildId: guildId);
  1807. return await SendAsync<IReadOnlyCollection<Webhook>>("GET", () => $"guilds/{guildId}/webhooks", ids, options: options).ConfigureAwait(false);
  1808. }
  1809. public async Task<IReadOnlyCollection<Webhook>> GetChannelWebhooksAsync(ulong channelId, RequestOptions options = null)
  1810. {
  1811. Preconditions.NotEqual(channelId, 0, nameof(channelId));
  1812. options = RequestOptions.CreateOrClone(options);
  1813. var ids = new BucketIds(channelId: channelId);
  1814. return await SendAsync<IReadOnlyCollection<Webhook>>("GET", () => $"channels/{channelId}/webhooks", ids, options: options).ConfigureAwait(false);
  1815. }
  1816. #endregion
  1817. #region Helpers
  1818. /// <exception cref="InvalidOperationException">Client is not logged in.</exception>
  1819. protected void CheckState()
  1820. {
  1821. if (LoginState != LoginState.LoggedIn)
  1822. throw new InvalidOperationException("Client is not logged in.");
  1823. }
  1824. protected static double ToMilliseconds(Stopwatch stopwatch) => Math.Round((double)stopwatch.ElapsedTicks / (double)Stopwatch.Frequency * 1000.0, 2);
  1825. protected string SerializeJson(object value)
  1826. {
  1827. var sb = new StringBuilder(256);
  1828. using (TextWriter text = new StringWriter(sb, CultureInfo.InvariantCulture))
  1829. using (JsonWriter writer = new JsonTextWriter(text))
  1830. _serializer.Serialize(writer, value);
  1831. return sb.ToString();
  1832. }
  1833. protected T DeserializeJson<T>(Stream jsonStream)
  1834. {
  1835. using (TextReader text = new StreamReader(jsonStream))
  1836. using (JsonReader reader = new JsonTextReader(text))
  1837. return _serializer.Deserialize<T>(reader);
  1838. }
  1839. protected async Task<T> TrySendApplicationCommandAsync<T>(Task<T> sendTask)
  1840. {
  1841. try
  1842. {
  1843. var result = await sendTask.ConfigureAwait(false);
  1844. if (sendTask.Exception != null)
  1845. {
  1846. if (sendTask.Exception.InnerException is HttpException x)
  1847. {
  1848. if (x.HttpCode == HttpStatusCode.BadRequest)
  1849. {
  1850. var json = (x.Request as JsonRestRequest).Json;
  1851. throw new ApplicationCommandException(json, x);
  1852. }
  1853. }
  1854. throw sendTask.Exception;
  1855. }
  1856. else
  1857. return result;
  1858. }
  1859. catch (HttpException x)
  1860. {
  1861. if (x.HttpCode == HttpStatusCode.BadRequest)
  1862. {
  1863. var json = (x.Request as JsonRestRequest).Json;
  1864. throw new ApplicationCommandException(json, x);
  1865. }
  1866. throw;
  1867. }
  1868. }
  1869. protected async Task<T> NullifyNotFound<T>(Task<T> sendTask) where T : class
  1870. {
  1871. try
  1872. {
  1873. var result = await sendTask.ConfigureAwait(false);
  1874. if (sendTask.Exception != null)
  1875. {
  1876. if (sendTask.Exception.InnerException is HttpException x)
  1877. {
  1878. if (x.HttpCode == HttpStatusCode.NotFound)
  1879. {
  1880. return null;
  1881. }
  1882. }
  1883. throw sendTask.Exception;
  1884. }
  1885. else
  1886. return result;
  1887. }
  1888. catch (HttpException x) when (x.HttpCode == HttpStatusCode.NotFound)
  1889. {
  1890. return null;
  1891. }
  1892. }
  1893. internal class BucketIds
  1894. {
  1895. public ulong GuildId { get; internal set; }
  1896. public ulong ChannelId { get; internal set; }
  1897. public ulong WebhookId { get; internal set; }
  1898. public string HttpMethod { get; internal set; }
  1899. internal BucketIds(ulong guildId = 0, ulong channelId = 0, ulong webhookId = 0)
  1900. {
  1901. GuildId = guildId;
  1902. ChannelId = channelId;
  1903. WebhookId = webhookId;
  1904. }
  1905. internal object[] ToArray()
  1906. => new object[] { HttpMethod, GuildId, ChannelId, WebhookId };
  1907. internal Dictionary<string, string> ToMajorParametersDictionary()
  1908. {
  1909. var dict = new Dictionary<string, string>();
  1910. if (GuildId != 0)
  1911. dict["GuildId"] = GuildId.ToString();
  1912. if (ChannelId != 0)
  1913. dict["ChannelId"] = ChannelId.ToString();
  1914. if (WebhookId != 0)
  1915. dict["WebhookId"] = WebhookId.ToString();
  1916. return dict;
  1917. }
  1918. internal static int? GetIndex(string name)
  1919. {
  1920. return name switch
  1921. {
  1922. "httpMethod" => 0,
  1923. "guildId" => 1,
  1924. "channelId" => 2,
  1925. "webhookId" => 3,
  1926. _ => null,
  1927. };
  1928. }
  1929. }
  1930. private static string GetEndpoint(Expression<Func<string>> endpointExpr)
  1931. {
  1932. return endpointExpr.Compile()();
  1933. }
  1934. private static BucketId GetBucketId(string httpMethod, BucketIds ids, Expression<Func<string>> endpointExpr, string callingMethod)
  1935. {
  1936. ids.HttpMethod ??= httpMethod;
  1937. return _bucketIdGenerators.GetOrAdd(callingMethod, x => CreateBucketId(endpointExpr))(ids);
  1938. }
  1939. private static Func<BucketIds, BucketId> CreateBucketId(Expression<Func<string>> endpoint)
  1940. {
  1941. try
  1942. {
  1943. //Is this a constant string?
  1944. if (endpoint.Body.NodeType == ExpressionType.Constant)
  1945. return x => BucketId.Create(x.HttpMethod, (endpoint.Body as ConstantExpression).Value.ToString(), x.ToMajorParametersDictionary());
  1946. var builder = new StringBuilder();
  1947. var methodCall = endpoint.Body as MethodCallExpression;
  1948. var methodArgs = methodCall.Arguments.ToArray();
  1949. string format = (methodArgs[0] as ConstantExpression).Value as string;
  1950. //Unpack the array, if one exists (happens with 4+ parameters)
  1951. if (methodArgs.Length > 1 && methodArgs[1].NodeType == ExpressionType.NewArrayInit)
  1952. {
  1953. var arrayExpr = methodArgs[1] as NewArrayExpression;
  1954. var elements = arrayExpr.Expressions.ToArray();
  1955. Array.Resize(ref methodArgs, elements.Length + 1);
  1956. Array.Copy(elements, 0, methodArgs, 1, elements.Length);
  1957. }
  1958. int endIndex = format.IndexOf('?'); //Don't include params
  1959. if (endIndex == -1)
  1960. endIndex = format.Length;
  1961. int lastIndex = 0;
  1962. while (true)
  1963. {
  1964. int leftIndex = format.IndexOf("{", lastIndex);
  1965. if (leftIndex == -1 || leftIndex > endIndex)
  1966. {
  1967. builder.Append(format, lastIndex, endIndex - lastIndex);
  1968. break;
  1969. }
  1970. builder.Append(format, lastIndex, leftIndex - lastIndex);
  1971. int rightIndex = format.IndexOf("}", leftIndex);
  1972. int argId = int.Parse(format.Substring(leftIndex + 1, rightIndex - leftIndex - 1), NumberStyles.None, CultureInfo.InvariantCulture);
  1973. string fieldName = GetFieldName(methodArgs[argId + 1]);
  1974. var mappedId = BucketIds.GetIndex(fieldName);
  1975. if (!mappedId.HasValue && rightIndex != endIndex && format.Length > rightIndex + 1 && format[rightIndex + 1] == '/') //Ignore the next slash
  1976. rightIndex++;
  1977. if (mappedId.HasValue)
  1978. builder.Append($"{{{mappedId.Value}}}");
  1979. lastIndex = rightIndex + 1;
  1980. }
  1981. if (builder[builder.Length - 1] == '/')
  1982. builder.Remove(builder.Length - 1, 1);
  1983. format = builder.ToString();
  1984. return x => BucketId.Create(x.HttpMethod, string.Format(format, x.ToArray()), x.ToMajorParametersDictionary());
  1985. }
  1986. catch (Exception ex)
  1987. {
  1988. throw new InvalidOperationException("Failed to generate the bucket id for this operation.", ex);
  1989. }
  1990. }
  1991. private static string GetFieldName(Expression expr)
  1992. {
  1993. if (expr.NodeType == ExpressionType.Convert)
  1994. expr = (expr as UnaryExpression).Operand;
  1995. if (expr.NodeType != ExpressionType.MemberAccess)
  1996. throw new InvalidOperationException("Unsupported expression");
  1997. return (expr as MemberExpression).Member.Name;
  1998. }
  1999. #endregion
  2000. }
  2001. }