Skip to content
This repository has been archived by the owner on Apr 20, 2022. It is now read-only.

Interaction Command Service #52

Merged
merged 203 commits into from
Nov 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
203 commits
Select commit Hold shift + click to select a range
835f3a1
init
Cenngo Jul 21, 2021
59333db
attribute rename
Cenngo Jul 21, 2021
30aa0c4
added docs
Cenngo Jul 21, 2021
1058a56
Revert "added docs"
Cenngo Jul 21, 2021
e1870c0
added basic docs
Cenngo Jul 21, 2021
35c071f
Switched to nested modules for method grouping, changed command trav…
Cenngo Jul 23, 2021
541b0be
interface now declares the helper methods
Cenngo Jul 26, 2021
c00c029
added new method with predicate parameter
Cenngo Jul 26, 2021
0ece97f
added config option for deleting the "thinking" state of unhandled co…
Cenngo Jul 26, 2021
3056108
Slash Module Base now exposes helper methods for interacting with the…
Cenngo Jul 26, 2021
058c275
Revert "interface now declares the helper methods"
Cenngo Jul 26, 2021
d44ec78
IDiscordInteraction now declares the helper methods
Cenngo Jul 26, 2021
0b52c85
new cancelable wait interaction method
Cenngo Jul 27, 2021
315e856
added support for user created command types
Cenngo Jul 28, 2021
0190250
Merge branch 'Discord-Net-Labs:release/2.x' into ApplicationCommandSe…
Cenngo Aug 1, 2021
4610e73
added option type 'number', added write method to typereaders
Cenngo Aug 2, 2021
612db46
added enum and timespan typereaders
Cenngo Aug 2, 2021
c73f097
revert
Cenngo Aug 8, 2021
4b759dc
added interface method declarations
Cenngo Aug 8, 2021
ae18da6
inline docs
Cenngo Aug 8, 2021
031189d
revert interface changes
Cenngo Aug 8, 2021
014cea6
upstream fetch
Cenngo Aug 9, 2021
7859af6
Merge pull request #7 from Discord-Net-Labs/feature/interations
Cenngo Aug 9, 2021
b7c5fd3
current user id assignment in sharded client
Cenngo Aug 9, 2021
d31cce9
Merge pull request #8 from Discord-Net-Labs/feature/interations
Cenngo Aug 9, 2021
2d68906
added wildcards to interactions, tweaks
Cenngo Aug 10, 2021
4494ca9
tweaks on interaction wild card pattern
Cenngo Aug 10, 2021
b91054f
Pre-app menu
quinchs Aug 11, 2021
91e529b
Merge pull request #9 from Discord-Net-Labs/feature/interations
Cenngo Aug 11, 2021
c5da344
Merge pull request #10 from Discord-Net-Labs/feature/interations
Cenngo Aug 11, 2021
68ee2c9
fixed CurrentUserId and added application command events
Cenngo Aug 11, 2021
334f63d
made event listener persistent
Cenngo Aug 11, 2021
845cd36
Sharded Client Application Command Events and CurrentUserId Issue (#105)
Cenngo Aug 19, 2021
b1633e7
removed option type converter, task offloaded to typereaders
Cenngo Aug 20, 2021
f3f33d1
added "deleteOGResponse" method to module base
Cenngo Aug 20, 2021
984863b
Merge pull request #11 from Discord-Net-Labs/feature/interations
Cenngo Aug 20, 2021
7643458
Merge pull request #12 from Discord-Net-Labs/feature/interations
Cenngo Aug 20, 2021
5e2d40e
Upstream fetch for Discord-Net-Labs/release/3.x
Cenngo Aug 24, 2021
3c44b2f
solved merge conflicts
Cenngo Aug 25, 2021
544836e
Merge branch 'Interactions' of https://github.com/Cenngo/Discord.Net-…
Cenngo Aug 25, 2021
6a1cabf
Merge pull request #14 from Discord-Net-Labs/release/3.x
Cenngo Aug 25, 2021
25d3e8a
removed merge artifacts
Cenngo Aug 25, 2021
bb93164
Merge branch 'ApplicationCommandService' into Interactions
Cenngo Aug 25, 2021
9a38eec
Merge pull request #15 from Cenngo/Interactions
Cenngo Aug 25, 2021
718d7d2
added new Context Command attributes
Cenngo Aug 25, 2021
d267a72
added Conxtext Command info classes and changed the naming scheme for…
Cenngo Aug 25, 2021
851968c
added IgnoreGroupNames prop to command attributes
Cenngo Aug 25, 2021
f3ecab4
added ContextCommand builder
Cenngo Aug 25, 2021
d502810
moved command builders to internal
Cenngo Aug 25, 2021
cf4ddff
added ContextCommand methods to the command service
Cenngo Aug 25, 2021
441d872
Merge branch 'Discord-Net-Labs:release/3.x' into ApplicationCommandSe…
Cenngo Aug 25, 2021
d95e93c
command service now uses InteractionHelper to register commands
Cenngo Aug 26, 2021
37cdd11
Merge branch 'ApplicationCommandService' of https://github.com/Cenngo…
Cenngo Aug 26, 2021
6b9fa97
bug fixes and refactorings
Cenngo Aug 31, 2021
b993196
docs update
Cenngo Aug 31, 2021
fe86a14
added inline docs to public members
Cenngo Aug 31, 2021
999257d
added inline docs
Cenngo Sep 2, 2021
95a2ca7
added method name property to command infos
Cenngo Sep 2, 2021
a8be880
added inline docs
Cenngo Sep 3, 2021
3d1d1a0
changed the execution callback to a declared delegate
Cenngo Sep 3, 2021
205c0c9
createInstance delegate is now created only once per module
Cenngo Sep 3, 2021
becb613
declared the ExecuteCallback delegate
Cenngo Sep 3, 2021
96dfa1e
introduced a way to modify the command permissions
Cenngo Sep 3, 2021
43c43e0
changed method names
Cenngo Sep 3, 2021
0f7368b
added optional compiled lambda module builder
Cenngo Sep 3, 2021
3343391
added the missing sync execution option
Cenngo Sep 4, 2021
690f1e3
moved run mode selection to the base class
Cenngo Sep 6, 2021
f6080f7
info class refactorings
Cenngo Sep 10, 2021
85060f8
switched to compiled lambda based method invoke
Cenngo Sep 10, 2021
23bdd09
command refactorings
Cenngo Sep 10, 2021
2f7fa1f
added docs
Cenngo Sep 11, 2021
f5f79b4
removed untended class
Cenngo Sep 11, 2021
fba0004
bug fixes
Cenngo Sep 11, 2021
97de552
Merge pull request #17 from Cenngo/AppCommandService/v2
Cenngo Sep 11, 2021
66aba65
minor refactorings
Cenngo Sep 15, 2021
843d183
reflection changes
Cenngo Sep 15, 2021
01df03f
bug fix for interaction parameters
Cenngo Sep 18, 2021
9eaf60c
commands and modules now groups the preconditons on building
Cenngo Sep 18, 2021
3d8dc7c
Merge pull request #19 from Discord-Net-Labs/release/3.x
Cenngo Sep 18, 2021
e4d6bd7
added default permission to context commands
Cenngo Sep 18, 2021
e845fe2
added DontAutoRegister attribute
Cenngo Sep 22, 2021
2321fea
renamed TypeReader to TypeConverter
Cenngo Sep 22, 2021
5ad085a
added docs to TypeConverterResult, made ISlashModuleBase public
Cenngo Sep 22, 2021
64bbfe1
namespace and project change
Cenngo Sep 23, 2021
9fb175e
added inline docs file
Cenngo Sep 23, 2021
25c5c67
renamed ExecuteComponentCommand method
Cenngo Sep 24, 2021
61666f7
added scoped service support to the dependency injection model
Cenngo Sep 24, 2021
e549208
fixed premature disposal of scoped services
Cenngo Sep 24, 2021
d78c4c7
extended the scope to cover the precondition checking methods
Cenngo Sep 24, 2021
b6ea1db
Merge pull request #20 from Cenngo/InteractionService
Cenngo Sep 24, 2021
2eeee6d
removed slash command related preconditions from core lib
Cenngo Sep 24, 2021
9c0980b
added sample application
Cenngo Sep 24, 2021
16709d5
precondition checks are now executed according to the command RunMode
Cenngo Sep 24, 2021
7f0eaf7
reverting the conflicting changes
Cenngo Sep 24, 2021
9eb2d30
reverted SocketInteraction
Cenngo Sep 24, 2021
6b8ee75
Merge pull request #21 from Discord-Net-Labs/release/3.x
Cenngo Sep 24, 2021
c4729eb
reverting more conflicts
Cenngo Sep 24, 2021
bdadf66
added indentations to inline docs
Cenngo Sep 25, 2021
08419a6
implemented change requests
Cenngo Sep 25, 2021
ab0220a
updated the sample app
Cenngo Sep 25, 2021
808ab20
moved builders to public
Cenngo Sep 27, 2021
6c6cb4c
added indentations to typeconverter docs
Cenngo Sep 27, 2021
74e97d2
renamed old componentCommandExecuted event
Cenngo Sep 27, 2021
fcc6195
bug fix for generic typeconverters
Cenngo Sep 27, 2021
933187b
Revert "bug fix for generic typeconverters"
Cenngo Sep 27, 2021
c997f5f
bug fix for context commands
Cenngo Sep 27, 2021
6090a01
code cleanup
Cenngo Sep 27, 2021
2d23ea7
removed public module build method
Cenngo Sep 28, 2021
4918a93
modev OnModuleBuilding execution inside the module build method
Cenngo Sep 28, 2021
d4d8b9f
added try-catch blocks encapsulating arg generation
Cenngo Sep 28, 2021
e300eb4
fixed parameter preconditions not raising commandExecuted event
Cenngo Sep 28, 2021
c5e214b
removed OnModuleBuilding execution from ModuleClassBuilder
Cenngo Sep 28, 2021
bdfdda4
removed setters from Precondition ErrorMessages
Cenngo Sep 28, 2021
a7e5756
added methods to interaction service for creating user defined modules
Cenngo Sep 28, 2021
09bac52
added IParameterInfo parameter to TypeConverter.Write
Cenngo Sep 30, 2021
2a81788
changed the target frameworks
Cenngo Sep 30, 2021
ba30474
DefaultValueConverter bug fix
Cenngo Oct 1, 2021
34492f4
GenerateArgs refactorings
Cenngo Oct 1, 2021
258c59c
WaitForMessageComponent now relies message id
Cenngo Oct 3, 2021
299d17b
Merge branch 'Discord-Net-Labs:release/3.x' into ApplicationCommandSe…
Cenngo Oct 4, 2021
203628c
added ChannelTypes support
Cenngo Oct 5, 2021
1ab1b0d
added ChannelTypes support
Cenngo Oct 5, 2021
129b4b7
updated channelType collection type
Cenngo Oct 5, 2021
7e784a6
Merge branch 'Discord-Net-Labs:release/3.x' into ApplicationCommandSe…
Cenngo Oct 11, 2021
82b1f43
fix build error for new lib version
Cenngo Oct 13, 2021
9a931f7
Merge pull request #24 from Discord-Net-Labs/release/3.x
Cenngo Oct 13, 2021
fbb0ee6
added ToString method to CommandInfo
Cenngo Oct 13, 2021
fd20183
added ToString method to CommandInfo
Cenngo Oct 13, 2021
e9fea93
Merge branch 'ApplicationCommandService' of https://github.com/Cenngo…
Cenngo Oct 13, 2021
1abc2bf
Fix index out of bounds error for new non-null slash command option c…
Cenngo Oct 13, 2021
c04bcdc
enum converter rework
Cenngo Oct 19, 2021
4ba36f7
added user extendable types to command context and module base
Cenngo Oct 19, 2021
847c03f
added regex anchors to ensure pattern matches the whole string
Cenngo Oct 20, 2021
0fd4af0
incomplete guides
Cenngo Oct 25, 2021
66b9342
add missing ignoreGroupNames assignment for ComponentInteraction
Cenngo Oct 26, 2021
0628bd1
Merge branch 'Discord-Net-Labs:release/3.x' into ApplicationCommandSe…
Cenngo Oct 30, 2021
141300f
typeconverters now seperate pascal casing parameter names
Cenngo Nov 1, 2021
307b45d
fix missing IServiceScopefactory ?
Cenngo Nov 1, 2021
6346838
Revert "typeconverters now seperate pascal casing parameter names"
Cenngo Nov 1, 2021
14a88e8
moved the option name pascal casing seperator to RestUtils
Cenngo Nov 1, 2021
aa5457a
fix component command arg generation
Cenngo Nov 2, 2021
8737ff5
removed , from default command delimiters
Cenngo Nov 2, 2021
04cb083
updated the regex to match every non whitespace value
Cenngo Nov 2, 2021
de2fa7c
added Autocomplete interaction support and updated the regex to match…
Cenngo Nov 2, 2021
e90ef61
fix inline docs
Cenngo Nov 2, 2021
9a8869d
replaced the posix class with range exps in pascal casing seperator
Cenngo Nov 3, 2021
776ecbb
added inline docs to autocompleter related classes
Cenngo Nov 3, 2021
4e5a7bc
Merge branch 'Discord-Net-Labs:release/3.x' into ApplicationCommandSe…
Cenngo Nov 4, 2021
4790c24
added regex metacharacter escape to wildcard patterns
Cenngo Nov 4, 2021
5ca63b6
added null check to Regex EscapeExcluding
Cenngo Nov 4, 2021
75f54fe
added .net5.0 support and updated the project package
Cenngo Nov 4, 2021
26e3c4c
added .net5.0 support and updated the project package
Cenngo Nov 4, 2021
6245ce0
added DeferAsync to module base
Cenngo Nov 5, 2021
0a0e269
add dependency injection to autocompleters
Cenngo Nov 8, 2021
49a653a
Merge branch 'Discord-Net-Labs:release/3.x' into ApplicationCommandSe…
Cenngo Nov 8, 2021
384618b
add net6.0
Cenngo Nov 9, 2021
ba4b5e9
Merge branch 'ApplicationCommandService' of https://github.com/Cenngo…
Cenngo Nov 9, 2021
e57dea1
bump versions
Cenngo Nov 9, 2021
f47f62d
Merge branch 'release/3.x' into ApplicationCommandService
Cenngo Nov 9, 2021
5b03a0d
bug fix: pascal casing parameters are not assigned
Cenngo Nov 10, 2021
b4c3e0c
rework autocomplete commands to accept command and parameter names se…
Cenngo Nov 10, 2021
b0b1de6
Merge branch 'Discord-Net-Labs:release/3.x' into ApplicationCommandSe…
Cenngo Nov 10, 2021
5243107
Merge branch 'ApplicationCommandService' of https://github.com/Cenngo…
Cenngo Nov 10, 2021
dd031b5
rename *InteractionCommandContext to *InteractionContext
Cenngo Nov 13, 2021
7e11b4d
add max-min value support to number type slash command options
Cenngo Nov 13, 2021
2deb41f
add hide attribute to deafult enum converter
Cenngo Nov 13, 2021
417165a
add inline docs
Cenngo Nov 13, 2021
ad3f26f
guides update: min/max value and autocomplete interactions
Cenngo Nov 13, 2021
ced9e22
remove net6.0 support
Cenngo Nov 14, 2021
86a91a6
add inline doc to Config.EnableAutocompleters
Cenngo Nov 14, 2021
717ed28
add autocompleters guide
Cenngo Nov 14, 2021
04fedb5
Merge branch 'ApplicationCommandService' of https://github.com/Cenngo…
Cenngo Nov 14, 2021
f2c6260
Merge branch 'Discord-Net-Labs:release/3.x' into ApplicationCommandSe…
Cenngo Nov 15, 2021
e66b8f4
added attribute usage to min/max value
Cenngo Nov 15, 2021
de91f00
Merge branch 'ApplicationCommandService' of https://github.com/Cenngo…
Cenngo Nov 15, 2021
4a34a21
implement rest based interactions
Cenngo Nov 15, 2021
2b18aed
add handling logic for rest based interactions
Cenngo Nov 15, 2021
3f33958
update default TypeConverters to accommodate rest based interactions
Cenngo Nov 15, 2021
9055054
added interaction specific interfaces
Cenngo Nov 18, 2021
1e10ce5
Merge branch 'Discord-Net-Labs:release/3.x' into release/3.x
Cenngo Nov 18, 2021
e2f3ae4
fix build error
Cenngo Nov 18, 2021
0b58935
Merge branch 'release/3.x' of https://github.com/Cenngo/Discord.Net-L…
Cenngo Nov 18, 2021
d1eb6c9
implement change requests
Cenngo Nov 18, 2021
5814bbd
Merge branch 'Discord-Net-Labs:release/3.x' into release/3.x
Cenngo Nov 19, 2021
6f6bec9
bump metapackage version
Cenngo Nov 19, 2021
e38f163
Merge branch 'Discord-Net-Labs:release/3.x' into ApplicationCommandSe…
Cenngo Nov 19, 2021
feeaba2
replace concrete interface types with interfaces in command execution…
Cenngo Nov 19, 2021
92c00ba
fix min/max value attribute target
Cenngo Nov 19, 2021
ff700e4
Merge branch 'release/3.x' into ApplicationCommandService
Cenngo Nov 21, 2021
1090180
add rest specific interaction module for creating interaction respons…
Cenngo Nov 22, 2021
ba88547
Merge branch 'ApplicationCommandService' of https://github.com/Cenngo…
Cenngo Nov 22, 2021
95a01f4
update rest callback to accept an interaction context parameter
Cenngo Nov 23, 2021
f06ce99
clean up RestResponseCallback implementation artifacts
Cenngo Nov 23, 2021
bc8060a
fix command registration bug when using the sharded socket client
Cenngo Nov 23, 2021
1c33a9e
update docs
Cenngo Nov 24, 2021
d383945
Merge branch 'release/3.x' into ApplicationCommandService
Cenngo Nov 24, 2021
1f969fd
fix build errors
Cenngo Nov 24, 2021
4dbaa39
fix slash command depth check
Cenngo Nov 24, 2021
d429164
implement requested changes
Cenngo Nov 25, 2021
02ccf59
fix build error
Cenngo Nov 25, 2021
ae6ebc4
the grand finale
Cenngo Nov 26, 2021
f7662dc
the grand finale
Cenngo Nov 26, 2021
64d74d4
Merge branch 'ApplicationCommandService' of https://github.com/Cenngo…
Cenngo Nov 26, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 32 additions & 14 deletions Discord.Net.sln
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31521.260
# Visual Studio Version 16
VisualStudioVersion = 16.0.31205.134
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Discord.Net.Core", "src\Discord.Net.Core\Discord.Net.Core.csproj", "{91E9E7BD-75C9-4E98-84AA-2C271922E5C2}"
EndProject
Expand Down Expand Up @@ -42,6 +42,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Discord.Net.Examples", "src
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "idn", "samples\idn\idn.csproj", "{4A03840B-9EBE-47E3-89AB-E0914DF21AFB}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Discord.Net.Interactions", "src\Discord.Net.Interactions\Discord.Net.Interactions.csproj", "{137DB209-B357-4EE8-A6EE-4B6127F6DEE9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "04_interactions_framework", "samples\04_interactions_framework\04_interactions_framework.csproj", "{A23E46D2-1610-4AE5-820F-422D34810887}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -232,18 +236,30 @@ Global
{4A03840B-9EBE-47E3-89AB-E0914DF21AFB}.Release|x64.Build.0 = Release|Any CPU
{4A03840B-9EBE-47E3-89AB-E0914DF21AFB}.Release|x86.ActiveCfg = Release|Any CPU
{4A03840B-9EBE-47E3-89AB-E0914DF21AFB}.Release|x86.Build.0 = Release|Any CPU
{0CC57A32-3AC7-489D-8DF5-C431925E4675}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0CC57A32-3AC7-489D-8DF5-C431925E4675}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0CC57A32-3AC7-489D-8DF5-C431925E4675}.Debug|x64.ActiveCfg = Debug|Any CPU
{0CC57A32-3AC7-489D-8DF5-C431925E4675}.Debug|x64.Build.0 = Debug|Any CPU
{0CC57A32-3AC7-489D-8DF5-C431925E4675}.Debug|x86.ActiveCfg = Debug|Any CPU
{0CC57A32-3AC7-489D-8DF5-C431925E4675}.Debug|x86.Build.0 = Debug|Any CPU
{0CC57A32-3AC7-489D-8DF5-C431925E4675}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0CC57A32-3AC7-489D-8DF5-C431925E4675}.Release|Any CPU.Build.0 = Release|Any CPU
{0CC57A32-3AC7-489D-8DF5-C431925E4675}.Release|x64.ActiveCfg = Release|Any CPU
{0CC57A32-3AC7-489D-8DF5-C431925E4675}.Release|x64.Build.0 = Release|Any CPU
{0CC57A32-3AC7-489D-8DF5-C431925E4675}.Release|x86.ActiveCfg = Release|Any CPU
{0CC57A32-3AC7-489D-8DF5-C431925E4675}.Release|x86.Build.0 = Release|Any CPU
{137DB209-B357-4EE8-A6EE-4B6127F6DEE9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{137DB209-B357-4EE8-A6EE-4B6127F6DEE9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{137DB209-B357-4EE8-A6EE-4B6127F6DEE9}.Debug|x64.ActiveCfg = Debug|Any CPU
{137DB209-B357-4EE8-A6EE-4B6127F6DEE9}.Debug|x64.Build.0 = Debug|Any CPU
{137DB209-B357-4EE8-A6EE-4B6127F6DEE9}.Debug|x86.ActiveCfg = Debug|Any CPU
{137DB209-B357-4EE8-A6EE-4B6127F6DEE9}.Debug|x86.Build.0 = Debug|Any CPU
{137DB209-B357-4EE8-A6EE-4B6127F6DEE9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{137DB209-B357-4EE8-A6EE-4B6127F6DEE9}.Release|Any CPU.Build.0 = Release|Any CPU
{137DB209-B357-4EE8-A6EE-4B6127F6DEE9}.Release|x64.ActiveCfg = Release|Any CPU
{137DB209-B357-4EE8-A6EE-4B6127F6DEE9}.Release|x64.Build.0 = Release|Any CPU
{137DB209-B357-4EE8-A6EE-4B6127F6DEE9}.Release|x86.ActiveCfg = Release|Any CPU
{137DB209-B357-4EE8-A6EE-4B6127F6DEE9}.Release|x86.Build.0 = Release|Any CPU
{A23E46D2-1610-4AE5-820F-422D34810887}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A23E46D2-1610-4AE5-820F-422D34810887}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A23E46D2-1610-4AE5-820F-422D34810887}.Debug|x64.ActiveCfg = Debug|Any CPU
{A23E46D2-1610-4AE5-820F-422D34810887}.Debug|x64.Build.0 = Debug|Any CPU
{A23E46D2-1610-4AE5-820F-422D34810887}.Debug|x86.ActiveCfg = Debug|Any CPU
{A23E46D2-1610-4AE5-820F-422D34810887}.Debug|x86.Build.0 = Debug|Any CPU
{A23E46D2-1610-4AE5-820F-422D34810887}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A23E46D2-1610-4AE5-820F-422D34810887}.Release|Any CPU.Build.0 = Release|Any CPU
{A23E46D2-1610-4AE5-820F-422D34810887}.Release|x64.ActiveCfg = Release|Any CPU
{A23E46D2-1610-4AE5-820F-422D34810887}.Release|x64.Build.0 = Release|Any CPU
{A23E46D2-1610-4AE5-820F-422D34810887}.Release|x86.ActiveCfg = Release|Any CPU
{A23E46D2-1610-4AE5-820F-422D34810887}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -263,6 +279,8 @@ Global
{FC67057C-E92F-4E1C-98BE-46F839C8AD71} = {C7CF5621-7D36-433B-B337-5A2E3C101A71}
{47820065-3CFB-401C-ACEA-862BD564A404} = {BB59D5B5-E7B0-4BF4-8F82-D14431B2799B}
{4A03840B-9EBE-47E3-89AB-E0914DF21AFB} = {BB59D5B5-E7B0-4BF4-8F82-D14431B2799B}
{137DB209-B357-4EE8-A6EE-4B6127F6DEE9} = {CC3D4B1C-9DE0-448B-8AE7-F3F1F3EC5C3A}
{A23E46D2-1610-4AE5-820F-422D34810887} = {BB59D5B5-E7B0-4BF4-8F82-D14431B2799B}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {D2404771-EEC8-45F2-9D71-F3373F6C1495}
Expand Down
22 changes: 22 additions & 0 deletions docs/guides/interactions_framework/autocompleters.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Autocompleters

Autocompleters provide a similar pattern to TypeConverters. Autocompleters are cached, singleton services and they are used by the Interaction Service to handle Autocomplete Interations targeted to a specific Slash Command parameter.

To start using Autocompleters, use the `[AutocompleteAttribute(Type autocompleterType)]` overload of the `[AutocompleteAttribute]`. This will dynamically link the parameter to the Autocompleter type.

## Creating Autocompleters

A valid Autocompleter must inherit `Autocompleter` base type and implement all of its abstract methods.

### GenerateSuggestionsAsync()

Interactions Service uses this method to generate a response to a Autocomplete Interaction. This method should return `AutocompletionResult.FromSuccess(IEnumerable<AutocompleteResult>)` to display parameter sugesstions to the user. If there are no suggestions to be presented to the user, you have two options:

1. Returning the parameterless `AutocompletionResult.FromSuccess()` will display "No options match your search." message to the user.
2. Returning `AutocompleteResult.FromError()` will make the Interaction Service not respond to the interation, consequently displaying the user "Loading options failed." message.

## Resolving Autocompleter Dependencies

Autocompleter dependencies are resolved using the same dependency injection pattern as the Interaction Modules. Property injection and constructor injection are both valid ways to get service dependencies.

Because Autocompleters are constructed at service startup, class dependencies are resolved only once. If you need to access per-request dependencies you can use the IServiceProvider parameter of the `GenerateSuggestionsAsync()` method.
22 changes: 22 additions & 0 deletions docs/guides/interactions_framework/dependency_injection.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Dependency Injection

Interaction Service uses dependency injection to perform most of its operations. This way, you can access service dependencies throughout the framework.

## Setup

1. Create a `Microsoft.Extensions.DependencyInjection.ServiceCollection`.
2. Add the dependencies you wish to use in the modules.
3. Build a `IServiceProvider` using the `BuildServiceProvider()` method of the `ServiceCollection`.
4. Pass the `IServiceProvider` to `AddModulesAsync()`, `AddModuleAsync()` and `ExecuteAsync()` methods.

## Accessing the Dependencies

Services of a `IServiceProvider` can be accessed using *Contructor Injection* and *Property Injection*.

Interaction Service will populate the constructor parameters using the provided `IServiceProvider`. Any public settable class Property will also be populated in the same manner.

## Service Scopes

Interaction Service has built-in support for scoped service types. Scoped lifetime services are instantiated once per command execution. Including the Preconditon checks, every module operation is executed within a single service scope (which is sepearate from the global service scope).

> For more in-depth information about service lifetimes check out [Microsoft Docs](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection?view=aspnetcore-5.0#service-lifetimes-1).
Loading