Commit Graph

3430 Commits

Author SHA1 Message Date
Cenk Ergen
fb4250b88c Feature: Component TypeConverters and CustomID TypeReaders (#2169)
* fix sharded client current user

* add custom setter to group property of module builder

* rename serilazation method

* init

* create typemap and default typereaders

* add default readers

* create typereader targetting flags

* seperate custom id readers with component typeconverters

* add typereaders

* add customid readers

* clean up component info argument parsing

* remove obsolete method

* add component typeconverters to modals

* fix build errors

* add inline docs

* bug fixes

* code cleanup and refactorings

* fix build errors

* add GenerateCustomIdString method to interaction service

* add GenerateCustomIdString method to interaction service

* add inline docs to componentparameterbuilder

* add inline docs to GenerateCustomIdStringAsync method
2022-03-09 16:10:00 -04:00
Discord-NET-Robot
cc6918d157 Add 10065 Error code (#2178)
Co-authored-by: Discord.Net Robot <robot@elons.sweatshop.stop>
2022-03-09 16:02:08 -04:00
Brendan McShane
a5d3add1d6 Fix error with flag params. (#2165) 2022-03-03 17:20:34 -04:00
KeylAmi
48bc723f9e Update bugreport.yml (#2159)
* Update bugreport.yml

* Update bugreport.yml

removed d.net reference. fixed spelling.

* Update bugreport.yml

Adjusted verbiage for clarity
2022-03-03 17:20:02 -04:00
Armano den Boef
7262990654 Resolve complex param sample reference (#2166) 2022-03-03 17:19:25 -04:00
MrCakeSlayer
1ba96d6fbd Add configuration toggle to suppress Unknown dispatch warnings (#2162) 2022-03-02 21:30:17 -04:00
Quin Lynch
50d0000e26 meta: 3.4.0 2022-03-02 20:13:58 -04:00
Cenk Ergen
5522bc443d Create Complex Params Docs (#2160)
* create complex params docs

* Update docs/guides/int_framework/intro.md

Co-authored-by: Quin Lynch <49576606+quinchs@users.noreply.github.com>
2022-03-02 20:02:12 -04:00
Quin Lynch
36d6ce9ec8 Unneeded build event (#2158)
Build() at the end of the command creation isn't needed. The build is done on line 34.

Co-authored-by: Cookiezzz <Cookiezzz@users.noreply.github.com>
2022-03-02 19:24:10 -04:00
Quin Lynch
507a18d389 Enforce valid button styles (#2157)
Co-authored-by: CottageDwellingCat <80918250+CottageDwellingCat@users.noreply.github.com>
2022-03-02 19:24:00 -04:00
Quin Lynch
c80067425a Display name support for enum type converter (#2156)
* Display name support for enum type converter

* allow display attribute on enum type converter

* update docs/examples to include enum Display sample

* Revert "allow display attribute on enum type converter"

This reverts commit a0eec5b7555d366f9de7421f6fcf6bc71f2a4557.

* adds ChoiceDisplay for enum type converters

* Update EnumChoiceAttribute.cs

* fix renamed folder issue

* fix namespace

Co-authored-by: Xeno <eliotd@gmail.com>
2022-03-02 19:23:51 -04:00
Quin Lynch
9ba64f62d1 Interaction Service Complex Parameters (#2155)
* Interaction Service Complex Parameters

* add complex parameters

* add complex parameters

* fix build errors

* add argument parsing

* add nested complex parameter checks

* add inline docs

* add preferred constructor declaration

* fix autocompletehandlers for complex parameters

* make GetConstructor private

* use flattened params in ToProps method

* make DiscordType of SlashParameter nullable

* add docs to Flattened parameters collection and move the GetComplexParameterCtor method

* add inline docs to SlashCommandParameterBuilder.ComplexParameterFields

* add check for validating required/optinal parameter order

* implement change requests

* return internal ParseResult as ExecuteResult

Co-Authored-By: Cenk Ergen <57065323+Cenngo@users.noreply.github.com>

* fix merge errors

Co-authored-by: Cenk Ergen <57065323+Cenngo@users.noreply.github.com>
2022-03-02 19:23:39 -04:00
CottageDwellingCat
1fb62de14b Support Sending Message Flags (#2131)
* Add message flags

* Add webhook message flags
2022-03-02 19:23:27 -04:00
Quin Lynch
b3370c33e2 Fix usage of CacheMode.AllowDownload in channels (#2154)
Co-Authored-By:  <25006819+sabihoshi@users.noreply.github.com>

Co-authored-by:  <25006819+sabihoshi@users.noreply.github.com>
2022-03-02 19:22:59 -04:00
Quin Lynch
6bf5818e72 Add IsInvitable and CreatedAt to threads (#2153)
* Add IsInvitable and CreatedAt to threads

* Update src/Discord.Net.Core/Entities/Channels/IThreadChannel.cs

Co-Authored-By: Jared L <48422312+lhjt@users.noreply.github.com>

Co-authored-by: Jared L <48422312+lhjt@users.noreply.github.com>
2022-03-02 19:22:29 -04:00
Quin Lynch
1dc473c7e4 Add Image property to Guild Scheduled Events (#2151)
* Add Image property to create and modify events

* Add CDN routes to get cover image

* Update banner names

* Update CDN.cs

* Update IGuildScheduledEvent.cs
2022-03-02 19:22:08 -04:00
Discord-NET-Robot
202554fdde [Robot] Add missing json error (#2152)
* Add 30046, 40004, 40060, 50068, 50086 Error codes

* Update src/Discord.Net.Core/DiscordErrorCode.cs

Co-authored-by: Discord.Net Robot <robot@elons.sweatshop.stop>
Co-authored-by: Quin Lynch <49576606+quinchs@users.noreply.github.com>
2022-03-02 18:31:52 -04:00
Quin Lynch
5594739135 Clarify Users property on SocketGuildChannel (#2149) 2022-03-02 16:43:33 -04:00
EpicOfficer
8bcd3da9e4 Add self_video to VoiceState (#2137)
* Add self_video to VoiceState

* Update selfVideo flag
2022-03-02 16:27:29 -04:00
Cenk Ergen
3e52fab67b Add return statement to precondition handling (#2062) 2022-03-02 16:25:06 -04:00
Armano den Boef
a13dce2550 FAQ rework, replacing outdated info, better interaction FAQ (#2106)
* FAQ rework, replacing outdated info, better interaction faq

* Update docs/faq/basics/getting-started.md

Co-authored-by: Jared L <48422312+lhjt@users.noreply.github.com>

* Update docs/faq/basics/getting-started.md

Co-authored-by: Jared L <48422312+lhjt@users.noreply.github.com>

* Update docs/faq/int_framework/general.md

Co-authored-by: Jared L <48422312+lhjt@users.noreply.github.com>

* fix TOC reference

Co-authored-by: Jared L <48422312+lhjt@users.noreply.github.com>
Co-authored-by: Quin Lynch <lynchquin@gmail.com>
2022-03-02 16:24:34 -04:00
Ilay Nahman
b7f6db96ef Fix docs typos (#2119)
Changed frist to first and dont to don't
2022-03-02 15:09:57 -04:00
Duke
1fc07e742f Guides for Serilog and EFCore (#2134)
* Add serilog guide

* added suggestions from Rozen

* Add efcore guide

* Fix review changes

* Fix grammatical errors & review points
2022-03-02 15:08:51 -04:00
Almighty-Shogun
7d8911bfed Fixed documentation typo's (#2127)
* Fixed typo at line 39

On this code example for the documentation there was a typo on the README.md file at line 39. There was an `;` where there should not be one.

The code that had the typo:

```cs
var tb = new TextInputBuilder()
    .WithLabel("Labeled")
    .WithCustomId("text_input")
    .WithStyle(TextInputStyle.Paragraph)
    .WithMinLength(6); // This ";" does not belong here.
    .WithMaxLength(42)
    .WithRequired(true)
    .WithPlaceholder("Consider this place held.");
```

* Changed `ExecuteAsync` to `ExecuteCommandAsync`

`_interactionService.ExecuteAsync(ctx, serviceProvider);` cannot be executed because the method `ExecuteAsync` does not exists.

* Changed `componBuild()` to `components.Build()`
2022-03-02 15:07:15 -04:00
d4n
f601e9bc34 Fix context menu comand message type (#2128) 2022-03-02 15:06:29 -04:00
CottageDwellingCat
b95b94231c Fix NRE when ratelimmited requests don't return a body (#2135) 2022-03-02 15:03:10 -04:00
sabihoshi
553055b724 feat: Add FromDateTimeOffset in TimestampTag (#2146) 2022-03-02 14:46:51 -04:00
Quin Lynch
a1cfa41953 Fix stream access exception when ratelimited (#2117) 2022-02-16 11:13:36 -04:00
Quin Lynch
92445fb247 meta: bump version 2022-02-16 10:54:21 -04:00
Quin Lynch
84eeb780d1 Revert "Fixes unused creation of REST clients for DiscordShardedClient shards. (#2109)" (#2116)
This reverts commit 6039378c52.
2022-02-16 10:43:04 -04:00
Armano den Boef
1ffe9eeca9 Add DisplayAvatar to IGuildUser (#2115) 2022-02-16 09:49:55 -04:00
Armano den Boef
9a33aa4371 Update bugreport.yml (#2112)
Updates the bugreport format to include heading to the discussions for non-bug related issues
2022-02-16 09:11:40 -04:00
Quin Lynch
62d4598fc9 meta: bump version 2022-02-16 08:40:56 -04:00
Quin Lynch
b2598d37b6 fix: Implement correct ratelimit handles for 429's (#2110)
* init

* fix errors
2022-02-16 08:20:57 -04:00
Armano den Boef
abfba3c4bb Add DisplayName property to IGuildUser. (#2107) 2022-02-16 07:52:08 -04:00
Armano den Boef
169d54f1df Fix being unable to modify AllowedMentions with no embeds set.(#2108) 2022-02-16 07:51:40 -04:00
Armano den Boef
6039378c52 Fixes unused creation of REST clients for DiscordShardedClient shards. (#2109)
* Init

* Remove unnecessary length check

* Swap out for any check

* Final; Check if parentclient was passed
2022-02-16 07:51:15 -04:00
Quin Lynch
fad217e8bc Fix crosspost ratelimits (#2100) 2022-02-12 06:51:36 -04:00
Quin Lynch
503d32aa7e Update interaction summaries (#2099)
* init

* Update RestMessageComponentData.cs

* Update src/Discord.Net.Rest/Entities/Interactions/RestApplicationCommandOption.cs

Co-authored-by: Jared L <48422312+lhjt@users.noreply.github.com>

* Update src/Discord.Net.Rest/Entities/Interactions/RestApplicationCommandOption.cs

Co-authored-by: Jared L <48422312+lhjt@users.noreply.github.com>

* Update src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketApplicationCommand.cs

Co-authored-by: Jared L <48422312+lhjt@users.noreply.github.com>

* Update src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketApplicationCommand.cs

Co-authored-by: Jared L <48422312+lhjt@users.noreply.github.com>

Co-authored-by: Jared L <48422312+lhjt@users.noreply.github.com>
2022-02-12 06:51:14 -04:00
Sean
69da238a0f prefer shortened linq update (#2093) 2022-02-11 21:45:54 -04:00
Armano den Boef
01735c82fb Fix ToString() on CommandInfo (#2094) 2022-02-11 21:45:36 -04:00
Quin Lynch
7e1b8c9db0 Fix channel being null in DMs on Interactions (#2098) 2022-02-11 21:43:32 -04:00
Quin Lynch
0352374e74 meta: bump 3.3.0 2022-02-09 00:33:37 -04:00
Quin Lynch
c8f175e11a Feature: Implement modals (#2087)
* Implement Modals (#428)

* Socket Modal Support

* fix shareded client support

* Properly use `HasResponded` instead of `_hasResponded`

* `ModalBuilder` and `TextInputBuilder` validation.

* make orginisation more consistant.

* Rest Modals.

* Docs + add missing methods

* fix message signatures and missing abstract members

* modal changes

* um?????

* update modal docs

* update docs - again for some reason

* cleanup

* fix message signatures

* add modal commands support to interaction service

* Fix _hasResponded

* update to new unsupported standard.

* Sending modals with Interaction service.

* fix spelling in ComponentBuilder

* sending IModals when responding to interactions

* interaction service modals

* fix rest modals

* spelling and minor improvements.

* improve interaction service modal proformance

* use precompiled lambda for interaction service modals

* respect user compiled lambda choice

* changes to modals in the interaction service (more)

* support compiled lambdas in modal properties.

* modal interactions tweaks

* fix inline doc

* more modal docs

* configure responce to faild modal component

* init

* solve runtime errors

* solve build errors

* add default value parsing

* make modal info caching static

* make ModalUtils static

* add inline docs

* fix build errors

* code cleanup

* Introduce Required and Label properties as seperate attributes.

* replace internal dictionary of ModalInfo with a list

* change input building logic of modals

* update RespondWithModalAsync method

* add initial value parameter back to ModalTextInput and fix optional modal field

* add missing inline docs

* dispose the reference modal instance after building

* code cleanup on modalcommandbuilder

* Update docs/guides/int_basics/message-components/text-input.md

Co-authored-by: Jared L <48422312+lhjt@users.noreply.github.com>

* Update docs/guides/int_basics/message-components/text-input.md

Co-authored-by: Jared L <48422312+lhjt@users.noreply.github.com>

* Update docs/guides/int_basics/modals/intro.md

Co-authored-by: Jared L <48422312+lhjt@users.noreply.github.com>

* Update docs/guides/int_basics/modals/intro.md

Co-authored-by: Jared L <48422312+lhjt@users.noreply.github.com>

* Update docs/guides/int_basics/modals/intro.md

Co-authored-by: Jared L <48422312+lhjt@users.noreply.github.com>

* Update docs/guides/int_basics/modals/intro.md

Co-authored-by: Jared L <48422312+lhjt@users.noreply.github.com>

* Update docs/guides/int_basics/modals/intro.md

Co-authored-by: Jared L <48422312+lhjt@users.noreply.github.com>

* Update docs/guides/int_basics/modals/intro.md

Co-authored-by: Jared L <48422312+lhjt@users.noreply.github.com>

* Update docs/guides/int_basics/modals/intro.md

Co-authored-by: Jared L <48422312+lhjt@users.noreply.github.com>

* Update docs/guides/int_framework/intro.md

Co-authored-by: Jared L <48422312+lhjt@users.noreply.github.com>

* Update docs/guides/int_framework/intro.md

Co-authored-by: Jared L <48422312+lhjt@users.noreply.github.com>

* Update docs/guides/int_framework/samples/intro/modal.cs

Co-authored-by: Jared L <48422312+lhjt@users.noreply.github.com>

* Update src/Discord.Net.Core/Entities/Interactions/MessageComponents/IComponentInteractionData.cs

Co-authored-by: Jared L <48422312+lhjt@users.noreply.github.com>

* Update src/Discord.Net.Core/Entities/Interactions/MessageComponents/TextInputComponent.cs

Co-authored-by: Jared L <48422312+lhjt@users.noreply.github.com>

* Update src/Discord.Net.Core/Entities/Interactions/Modals/IModalInteraction.cs

Co-authored-by: Jared L <48422312+lhjt@users.noreply.github.com>

* Update src/Discord.Net.Core/Entities/Interactions/Modals/ModalBuilder.cs

Co-authored-by: Jared L <48422312+lhjt@users.noreply.github.com>

* Update src/Discord.Net.Core/Entities/Interactions/Modals/ModalBuilder.cs

Co-authored-by: Jared L <48422312+lhjt@users.noreply.github.com>

* Update src/Discord.Net.Core/Entities/Interactions/Modals/ModalBuilder.cs

Co-authored-by: Jared L <48422312+lhjt@users.noreply.github.com>

* Update src/Discord.Net.Core/Entities/Interactions/Modals/ModalBuilder.cs

Co-authored-by: Jared L <48422312+lhjt@users.noreply.github.com>

* Update src/Discord.Net.Core/Entities/Interactions/Modals/ModalBuilder.cs

Co-authored-by: Jared L <48422312+lhjt@users.noreply.github.com>

* Update src/Discord.Net.Core/Entities/Interactions/Modals/ModalBuilder.cs

Co-authored-by: Jared L <48422312+lhjt@users.noreply.github.com>

* Update src/Discord.Net.Interactions/Attributes/Commands/ModalInteractionAttribute.cs

Co-authored-by: Jared L <48422312+lhjt@users.noreply.github.com>

* Update src/Discord.Net.Interactions/Attributes/Modals/RequiredInputAttribute.cs

Co-authored-by: Jared L <48422312+lhjt@users.noreply.github.com>

* Update src/Discord.Net.Interactions/InteractionServiceConfig.cs

Co-authored-by: Jared L <48422312+lhjt@users.noreply.github.com>

* Update src/Discord.Net.WebSocket/Entities/Interaction/MessageComponents/SocketMessageComponentData.cs

Co-authored-by: Jared L <48422312+lhjt@users.noreply.github.com>

* Update src/Discord.Net.WebSocket/Entities/Interaction/Modals/SocketModalData.cs

Co-authored-by: Jared L <48422312+lhjt@users.noreply.github.com>

* update interaction service modal docs

* implements ExitOnMissingmModalField config option and adds Type field to modal info

* Add WithValue to text input builders

* Fix rare NRE on component enumeration

* Fix RequestOptions being required in some methods

* Use 'OfType' instead of 'Where'

* Remove android unsported warning

* Change publicity of properties in IInputComponeontBuilder.cs

Co-authored-by: Cenk Ergen <57065323+Cenngo@users.noreply.github.com>
Co-authored-by: Jared L <48422312+lhjt@users.noreply.github.com>

* Remove complex parameter ref

Co-authored-by: CottageDwellingCat <80918250+CottageDwellingCat@users.noreply.github.com>
Co-authored-by: Cenk Ergen <57065323+Cenngo@users.noreply.github.com>
Co-authored-by: Jared L <48422312+lhjt@users.noreply.github.com>
2022-02-09 00:17:56 -04:00
Quin Lynch
33efd8981d Add support for attachments (#2088)
* Enforce valid button styles

* support command option type 11

* missing '.'

* Added type converter.

Co-authored-by: Cat <lumitydev@gmail.com>
Co-authored-by: CottageDwellingCat <80918250+CottageDwellingCat@users.noreply.github.com>

Co-authored-by: FeroxFoxxo <feroxfoxxo@gmail.com>
Co-authored-by: Cat <lumitydev@gmail.com>
Co-authored-by: CottageDwellingCat <80918250+CottageDwellingCat@users.noreply.github.com>
2022-02-09 00:13:15 -04:00
Quin Lynch
d142710d2a fix guild feature enum (#2089) 2022-02-09 00:12:54 -04:00
Quin Lynch
6290f75359 Fix attempts to fetch channels in interactions (#2090)
* fix attempts to fetch channels in interactions

* remove test case
2022-02-09 00:12:41 -04:00
Quin Lynch
97e54e1047 Feature: Allow modifying attachments on interactions and extend the module base (#2091) 2022-02-09 00:12:22 -04:00
Quin Lynch
b424bb2019 Fix Current user null on reconnect (#2092) 2022-02-09 00:12:07 -04:00
Quin Lynch
75e94feab0 Add IEnumerable collection parameters instead of arrays for MessageExtensions (#2079) 2022-02-08 21:45:48 -04:00