{{^_disableBreadcrumb}}
{{>partials/breadcrumb}}
{{/_disableBreadcrumb}}
{{^_disableToc}}
{{>partials/toc}}
{{/_disableToc}}
{{#_disableToc}}
{{/_disableToc}}
{{!body}}
{{#_copyrightFooter}}
{{/_copyrightFooter}}
{{>partials/scripts}}
diff --git a/DisCatSharp.Docs/dcs/partials/_scripts.liquid b/DisCatSharp.Docs/dcs/partials/_scripts.liquid
index 47f5d37f2..24c5cf1cf 100644
--- a/DisCatSharp.Docs/dcs/partials/_scripts.liquid
+++ b/DisCatSharp.Docs/dcs/partials/_scripts.liquid
@@ -1,6 +1,12 @@
{% comment -%}Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.{% endcomment -%}
+
+
-
+
+
+
+
+
diff --git a/DisCatSharp.Docs/dcs/partials/scripts.tmpl.partial b/DisCatSharp.Docs/dcs/partials/scripts.tmpl.partial
index 8ef5d03ae..a3de47021 100644
--- a/DisCatSharp.Docs/dcs/partials/scripts.tmpl.partial
+++ b/DisCatSharp.Docs/dcs/partials/scripts.tmpl.partial
@@ -1,13 +1,12 @@
{{!Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.}}
-
-
+
diff --git a/DisCatSharp.Docs/docfx.json b/DisCatSharp.Docs/docfx.json
index c238ec19c..543f250fa 100644
--- a/DisCatSharp.Docs/docfx.json
+++ b/DisCatSharp.Docs/docfx.json
@@ -1,265 +1,446 @@
{
"metadata":[
{
"src":[
{
"src":"../DisCatSharp/",
"files":[
"**.csproj"
],
"exclude":[
"**/obj/**",
"**/bin/**"
]
}
],
"dest":"api/DisCatSharp",
- "filter":"filter_config.yml"
+ "filter":"filter_config.yml",
+ "disableDefaultFilter":false
},
{
"src":[
{
"src":"../DisCatSharp.Interactivity/",
"files":[
"**.csproj"
],
"exclude":[
"**/obj/**",
"**/bin/**"
]
}
],
"dest":"api/DisCatSharp.Interactivity",
- "filter":"filter_config.yml"
+ "filter":"filter_config.yml",
+ "disableDefaultFilter":false
},
{
"src":[
{
"src":"../DisCatSharp.Common/",
"files":[
"**.csproj"
],
"exclude":[
"**/obj/**",
"**/bin/**"
]
}
],
"dest":"api/DisCatSharp.Common",
- "filter":"filter_config.yml"
+ "filter":"filter_config.yml",
+ "disableDefaultFilter":false
},
{
"src":[
{
"src":"../DisCatSharp.Hosting/",
"files":[
"**.csproj"
],
"exclude":[
"**/obj/**",
"**/bin/**"
]
}
],
"dest":"api/DisCatSharp.Hosting",
- "filter":"filter_config.yml"
+ "filter":"filter_config.yml",
+ "disableDefaultFilter":false
},
{
"src":[
{
"src":"../DisCatSharp.Configuration/",
"files":[
"**.csproj"
],
"exclude":[
"**/obj/**",
"**/bin/**"
]
}
],
"dest":"api/DisCatSharp.Configuration",
- "filter":"filter_config.yml"
+ "filter":"filter_config.yml",
+ "disableDefaultFilter":false
},
{
"src":[
{
"src":"../DisCatSharp.ApplicationCommands/",
"files":[
"**.csproj"
],
"exclude":[
"**/obj/**",
"**/bin/**"
]
}
],
"dest":"api/DisCatSharp.ApplicationCommands",
- "filter":"filter_config.yml"
+ "filter":"filter_config.yml",
+ "disableDefaultFilter":false
},
{
"src":[
{
"src":"../DisCatSharp.CommandsNext/",
"files":[
"**.csproj"
],
"exclude":[
"**/obj/**",
"**/bin/**"
]
}
],
"dest":"api/DisCatSharp.CommandsNext",
- "filter":"filter_config.yml"
+ "filter":"filter_config.yml",
+ "disableDefaultFilter":false
},
{
"src":[
{
"src":"../DisCatSharp.Hosting.DependencyInjection/",
"files":[
"**.csproj"
],
"exclude":[
"**/obj/**",
"**/bin/**"
]
}
],
"dest":"api/DisCatSharp.Hosting.DependencyInjection",
- "filter":"filter_config.yml"
+ "filter":"filter_config.yml",
+ "disableDefaultFilter":false
},
{
"src":[
{
"src":"../DisCatSharp.Lavalink/",
"files":[
"**.csproj"
],
"exclude":[
"**/obj/**",
"**/bin/**"
]
}
],
"dest":"api/DisCatSharp.Lavalink",
- "filter":"filter_config.yml"
+ "filter":"filter_config.yml",
+ "disableDefaultFilter":false
},
{
"src":[
{
"src":"../DisCatSharp.VoiceNext/",
"files":[
"**.csproj"
],
"exclude":[
"**/obj/**",
"**/bin/**"
]
}
],
"dest":"api/DisCatSharp.VoiceNext",
- "filter":"filter_config.yml"
+ "filter":"filter_config.yml",
+ "disableDefaultFilter":false
+ },
+ {
+ "src":[
+ {
+ "src":"../DisCatSharp/",
+ "files":[
+ "**.csproj"
+ ],
+ "exclude":[
+ "**/obj/**",
+ "**/bin/**"
+ ]
+ }
+ ],
+ "dest":"libdev/DisCatSharp",
+ "filter":"filter_config.yml",
+ "disableDefaultFilter":true
+ },
+ {
+ "src":[
+ {
+ "src":"../DisCatSharp.Interactivity/",
+ "files":[
+ "**.csproj"
+ ],
+ "exclude":[
+ "**/obj/**",
+ "**/bin/**"
+ ]
+ }
+ ],
+ "dest":"libdev/DisCatSharp.Interactivity",
+ "filter":"filter_config.yml",
+ "disableDefaultFilter":true
+ },
+ {
+ "src":[
+ {
+ "src":"../DisCatSharp.Common/",
+ "files":[
+ "**.csproj"
+ ],
+ "exclude":[
+ "**/obj/**",
+ "**/bin/**"
+ ]
+ }
+ ],
+ "dest":"libdev/DisCatSharp.Common",
+ "filter":"filter_config.yml",
+ "disableDefaultFilter":true
+ },
+ {
+ "src":[
+ {
+ "src":"../DisCatSharp.Hosting/",
+ "files":[
+ "**.csproj"
+ ],
+ "exclude":[
+ "**/obj/**",
+ "**/bin/**"
+ ]
+ }
+ ],
+ "dest":"libdev/DisCatSharp.Hosting",
+ "filter":"filter_config.yml",
+ "disableDefaultFilter":true
+ },
+ {
+ "src":[
+ {
+ "src":"../DisCatSharp.Configuration/",
+ "files":[
+ "**.csproj"
+ ],
+ "exclude":[
+ "**/obj/**",
+ "**/bin/**"
+ ]
+ }
+ ],
+ "dest":"libdev/DisCatSharp.Configuration",
+ "filter":"filter_config.yml",
+ "disableDefaultFilter":true
+ },
+ {
+ "src":[
+ {
+ "src":"../DisCatSharp.ApplicationCommands/",
+ "files":[
+ "**.csproj"
+ ],
+ "exclude":[
+ "**/obj/**",
+ "**/bin/**"
+ ]
+ }
+ ],
+ "dest":"libdev/DisCatSharp.ApplicationCommands",
+ "filter":"filter_config.yml",
+ "disableDefaultFilter":true
+ },
+ {
+ "src":[
+ {
+ "src":"../DisCatSharp.CommandsNext/",
+ "files":[
+ "**.csproj"
+ ],
+ "exclude":[
+ "**/obj/**",
+ "**/bin/**"
+ ]
+ }
+ ],
+ "dest":"libdev/DisCatSharp.CommandsNext",
+ "filter":"filter_config.yml",
+ "disableDefaultFilter":true
+ },
+ {
+ "src":[
+ {
+ "src":"../DisCatSharp.Hosting.DependencyInjection/",
+ "files":[
+ "**.csproj"
+ ],
+ "exclude":[
+ "**/obj/**",
+ "**/bin/**"
+ ]
+ }
+ ],
+ "dest":"libdev/DisCatSharp.Hosting.DependencyInjection",
+ "filter":"filter_config.yml",
+ "disableDefaultFilter":true
+ },
+ {
+ "src":[
+ {
+ "src":"../DisCatSharp.Lavalink/",
+ "files":[
+ "**.csproj"
+ ],
+ "exclude":[
+ "**/obj/**",
+ "**/bin/**"
+ ]
+ }
+ ],
+ "dest":"libdev/DisCatSharp.Lavalink",
+ "filter":"filter_config.yml",
+ "disableDefaultFilter":true
+ },
+ {
+ "src":[
+ {
+ "src":"../DisCatSharp.VoiceNext/",
+ "files":[
+ "**.csproj"
+ ],
+ "exclude":[
+ "**/obj/**",
+ "**/bin/**"
+ ]
+ }
+ ],
+ "dest":"libdev/DisCatSharp.VoiceNext",
+ "filter":"filter_config.yml",
+ "disableDefaultFilter":true
}
],
"build":{
"xrefService":[
"https://xref.docs.microsoft.com/query?uid={uid}"
],
"content":[
{
"files":[
"api/**/**.yml",
"api/**/**.md",
"api/**.yml",
"api/**.md"
+ ],
+ "exclude":[
+ "libdev/**"
]
},
+ {
+ "files":[
+ "libdev/**/**.yml",
+ "libdev/**/**.md",
+ "libdev/**.yml",
+ "libdev/**.md"
+ ],
+ "exclude":[
+ "api/**"
+ ],
+ "version":"internal"
+ },
{
"files":[
"**.md",
"toc.yml",
"faq/**.yml",
"faq/**.md",
"articles/**.yml",
"articles/**.md",
"changelogs/**.yml",
"changelogs/**.md",
"natives/**.yml",
- "natives/**.md"
+ "natives/**.md",
+ ".htaccess"
],
"exclude":[
"**/bin/**",
"**/obj/**",
"_site/**",
"dcs/**"
]
}
],
"resource":[
{
"files":[
"images/**",
"natives/**.zip"
],
"exclude":[
"**/bin/**",
"**/obj/**",
"_site/**",
"images/_**"
]
}
],
- "overwrite":[
- {
- "files":[
-
- ],
- "exclude":[
- "**/bin/**",
- "**/obj/**",
- "_site/**"
- ]
- }
- ],
+ "overwrite":[],
"dest":"_site",
"globalMetadata":{
"_appTitle": "DisCatSharp Docs",
"_appName": "DisCatSharp",
"_appFooter": "
Made with ♥ by AITSYS",
"_copyrightFooter": "© Aiko IT Systems. All rights reserved.",
"_enableSearch":true,
"_disableSideFilter": false,
"_enableNewTab":true,
"_disableContribution": false,
"_disableBreadcrumb": false,
"_gitUrlPattern":"git",
"_gitContribute":{
"repo":"https://github.com/Aiko-IT-Systems/DisCatSharp",
"branch":"main"
}
},
"disableGitFeatures":false,
"exportRawModel":true,
- "globalMetadataFiles":[
-
- ],
- "fileMetadataFiles":[
-
- ],
+ "globalMetadataFiles":[],
+ "fileMetadataFiles":[],
"template":[
"dcs"
],
"postProcessors":[
"ExtractSearchIndex",
"CustomMemberIndexer"
],
"noLangKeyword":false,
"keepFileLink":false,
"cleanupCacheHistory":false,
"sitemap":{
"baseUrl":"https://docs.discatsharp.tech/",
"changefreq":"daily",
"priority":1.0
}
}
}
diff --git a/DisCatSharp.Docs/filter_config.yml b/DisCatSharp.Docs/filter_config.yml
index 0fe7ea8cf..80db3aa3a 100644
--- a/DisCatSharp.Docs/filter_config.yml
+++ b/DisCatSharp.Docs/filter_config.yml
@@ -1,11 +1,89 @@
apiRules:
- exclude:
uidRegex: ^DisCatSharp\.Hosting\.Tests$
- exclude:
uidRegex: ^DisCatSharp\.Tests$
- exclude:
uidRegex: ^DisCatSharp\.Configuration\.Tests$
- include:
uidRegex: ^DisCatSharp
- exclude:
uidRegex: ^Newtonsoft\.Json$
+- exclude:
+ hasAttribute:
+ uid: System.ComponentModel.EditorBrowsableAttribute
+ ctorArguments:
+ - System.ComponentModel.EditorBrowsableState.Never
+attributeRules:
+- exclude:
+ uidRegex: ^System\.ComponentModel\.Design$
+ type: Namespace
+- exclude:
+ uidRegex: ^System\.ComponentModel\.Design\.Serialization$
+ type: Namespace
+- exclude:
+ uidRegex: ^System\.Xml\.Serialization$
+ type: Namespace
+- exclude:
+ uidRegex: ^System\.Web\.Compilation$
+ type: Namespace
+- exclude:
+ uidRegex: ^System\.Runtime\.Versioning$
+ type: Namespace
+- exclude:
+ uidRegex: ^System\.Runtime\.ConstrainedExecution$
+ type: Namespace
+- exclude:
+ uidRegex: ^System\.EnterpriseServices$
+ type: Namespace
+- exclude:
+ uidRegex: ^System\.Diagnostics\.CodeAnalysis$
+ type: Namespace
+- include:
+ uidRegex: ^System\.Diagnostics\.(ConditionalAttribute|EventLogPermissionAttribute|PerformanceCounterPermissionAttribute)$
+ type: Type
+- exclude:
+ uidRegex: '^System\.Diagnostics\.[^.]+$'
+ type: Type
+- include:
+ uidRegex: ^System\.ComponentModel\.(BindableAttribute|BrowsableAttribute|ComplexBindingPropertiesAttribute|DataObjectAttribute|DefaultBindingPropertyAttribute|ListBindableAttribute|LookupBindingPropertiesAttribute|SettingsBindableAttribute|TypeConverterAttribute)$
+ type: Type
+- exclude:
+ uidRegex: '^System\.ComponentModel\.[^.]+$'
+ type: Type
+- exclude:
+ uidRegex: ^System\.Reflection\.DefaultMemberAttribute$
+ type: Type
+- exclude:
+ uidRegex: ^System\.CodeDom\.Compiler\.GeneratedCodeAttribute$
+ type: Type
+- include:
+ uidRegex: ^System\.Runtime\.CompilerServices\.ExtensionAttribute$
+ type: Type
+- exclude:
+ uidRegex: '^System\.Runtime\.CompilerServices\.[^.]+$'
+ type: Type
+- include:
+ uidRegex: ^System\.Runtime\.InteropServices\.(ComVisibleAttribute|GuidAttribute|ClassInterfaceAttribute|InterfaceTypeAttribute)$
+ type: Type
+- exclude:
+ uidRegex: '^System\.Runtime\.InteropServices\.[^.]+$'
+ type: Type
+- include:
+ uidRegex: ^System\.Security\.(SecurityCriticalAttribute|SecurityTreatAsSafeAttribute|AllowPartiallyTrustedCallersAttribute)$
+ type: Type
+- exclude:
+ uidRegex: '^System\.Security\.[^.]+$'
+ type: Type
+- include:
+ uidRegex: ^System\.Web\.UI\.(ControlValuePropertyAttribute|PersistenceModeAttribute|ValidationPropertyAttribute|WebResourceAttribute|TemplateContainerAttribute|ThemeableAttribute|TemplateInstanceAttribute)$
+ type: Type
+- exclude:
+ uidRegex: '^System\.Web\.UI\.[^.]+$'
+ type: Type
+- include:
+ uidRegex: ^System\.Windows\.Markup\.(ConstructorArgumentAttribute|DesignerSerializationOptionsAttribute|ValueSerializerAttribute|XmlnsCompatibleWithAttribute|XmlnsDefinitionAttribute|XmlnsPrefixAttribute)$
+ type: Type
+- exclude:
+ uidRegex: '^System\.Windows\.Markup\.[^.]+$'
+ type: Type
diff --git a/DisCatSharp.Docs/libdev/.gitignore b/DisCatSharp.Docs/libdev/.gitignore
new file mode 100644
index 000000000..fb742eca1
--- /dev/null
+++ b/DisCatSharp.Docs/libdev/.gitignore
@@ -0,0 +1,5 @@
+###############
+# temp file #
+###############
+*.yml
+!toc.yml
diff --git a/DisCatSharp.Docs/libdev/DisCatSharp.ApplicationCommands/index.md b/DisCatSharp.Docs/libdev/DisCatSharp.ApplicationCommands/index.md
new file mode 100644
index 000000000..ceb64b43c
--- /dev/null
+++ b/DisCatSharp.Docs/libdev/DisCatSharp.ApplicationCommands/index.md
@@ -0,0 +1,12 @@
+---
+uid: libdev_discatsharp_applicationcommands_index
+title: DisCatSharp.ApplicationCommands API Reference
+---
+
+# API Reference
+
+Welcome to the DisCatSharp.ApplicationCommands API reference.
+
+To begin, select a namespace, then a class, from the table of contents on the left.
+
+If you encounter any problems or see typos, please inform us on our [Discord server](https://discord.gg/Uk7sggRBTm).
diff --git a/DisCatSharp.Docs/libdev/DisCatSharp.CommandsNext/index.md b/DisCatSharp.Docs/libdev/DisCatSharp.CommandsNext/index.md
new file mode 100644
index 000000000..caea00991
--- /dev/null
+++ b/DisCatSharp.Docs/libdev/DisCatSharp.CommandsNext/index.md
@@ -0,0 +1,12 @@
+---
+uid: libdev_discatsharp_commandsnext_index
+title: DisCatSharp.CommandsNext API Reference
+---
+
+# API Reference
+
+Welcome to the DisCatSharp.CommandsNext API reference.
+
+To begin, select a namespace, then a class, from the table of contents on the left.
+
+If you encounter any problems or see typos, please inform us on our [Discord server](https://discord.gg/Uk7sggRBTm).
diff --git a/DisCatSharp.Docs/libdev/DisCatSharp.Common/index.md b/DisCatSharp.Docs/libdev/DisCatSharp.Common/index.md
new file mode 100644
index 000000000..051a88675
--- /dev/null
+++ b/DisCatSharp.Docs/libdev/DisCatSharp.Common/index.md
@@ -0,0 +1,12 @@
+---
+uid: libdev_discatsharp_common_index
+title: DisCatSharp.Common API Reference
+---
+
+# API Reference
+
+Welcome to the DisCatSharp.Common API reference.
+
+To begin, select a namespace, then a class, from the table of contents on the left.
+
+If you encounter any problems or see typos, please inform us on our [Discord server](https://discord.gg/Uk7sggRBTm).
diff --git a/DisCatSharp.Docs/libdev/DisCatSharp.Configuration/index.md b/DisCatSharp.Docs/libdev/DisCatSharp.Configuration/index.md
new file mode 100644
index 000000000..e8fa76352
--- /dev/null
+++ b/DisCatSharp.Docs/libdev/DisCatSharp.Configuration/index.md
@@ -0,0 +1,12 @@
+---
+uid: libdev_discatsharp_configuration_index
+title: DisCatSharp.Configuration API Reference
+---
+
+# API Reference
+
+Welcome to the DisCatSharp.Configuration API reference.
+
+To begin, select a namespace, then a class, from the table of contents on the left.
+
+If you encounter any problems or see typos, please inform us on our [Discord server](https://discord.gg/Uk7sggRBTm).
diff --git a/DisCatSharp.Docs/libdev/DisCatSharp.Hosting.DependencyInjection/index.md b/DisCatSharp.Docs/libdev/DisCatSharp.Hosting.DependencyInjection/index.md
new file mode 100644
index 000000000..be47d22d7
--- /dev/null
+++ b/DisCatSharp.Docs/libdev/DisCatSharp.Hosting.DependencyInjection/index.md
@@ -0,0 +1,12 @@
+---
+uid: libdev_discatsharp_hosting_dependencyinjection_index
+title: DisCatSharp.Hosting.DependencyInjection API Reference
+---
+
+# API Reference
+
+Welcome to the DisCatSharp.Hosting.DependencyInjection API reference.
+
+To begin, select a namespace, then a class, from the table of contents on the left.
+
+If you encounter any problems or see typos, please inform us on our [Discord server](https://discord.gg/Uk7sggRBTm).
diff --git a/DisCatSharp.Docs/libdev/DisCatSharp.Hosting/index.md b/DisCatSharp.Docs/libdev/DisCatSharp.Hosting/index.md
new file mode 100644
index 000000000..948139b23
--- /dev/null
+++ b/DisCatSharp.Docs/libdev/DisCatSharp.Hosting/index.md
@@ -0,0 +1,12 @@
+---
+uid: libdev_discatsharp_hosting_index
+title: DisCatSharp.Hosting API Reference
+---
+
+# API Reference
+
+Welcome to the DisCatSharp.Hosting API reference.
+
+To begin, select a namespace, then a class, from the table of contents on the left.
+
+If you encounter any problems or see typos, please inform us on our [Discord server](https://discord.gg/Uk7sggRBTm).
diff --git a/DisCatSharp.Docs/libdev/DisCatSharp.Interactivity/index.md b/DisCatSharp.Docs/libdev/DisCatSharp.Interactivity/index.md
new file mode 100644
index 000000000..8b98667a7
--- /dev/null
+++ b/DisCatSharp.Docs/libdev/DisCatSharp.Interactivity/index.md
@@ -0,0 +1,12 @@
+---
+uid: libdev_discatsharp_interactivity_index
+title: DisCatSharp.Interactivity API Reference
+---
+
+# API Reference
+
+Welcome to the DisCatSharp.Interactivity API reference.
+
+To begin, select a namespace, then a class, from the table of contents on the left.
+
+If you encounter any problems or see typos, please inform us on our [Discord server](https://discord.gg/Uk7sggRBTm).
diff --git a/DisCatSharp.Docs/libdev/DisCatSharp.Lavalink/index.md b/DisCatSharp.Docs/libdev/DisCatSharp.Lavalink/index.md
new file mode 100644
index 000000000..49e826e4f
--- /dev/null
+++ b/DisCatSharp.Docs/libdev/DisCatSharp.Lavalink/index.md
@@ -0,0 +1,12 @@
+---
+uid: libdev_discatsharp_lavalink_index
+title: DisCatSharp.Lavalink API Reference
+---
+
+# API Reference
+
+Welcome to the DisCatSharp.Lavalink API reference.
+
+To begin, select a namespace, then a class, from the table of contents on the left.
+
+If you encounter any problems or see typos, please inform us on our [Discord server](https://discord.gg/Uk7sggRBTm).
diff --git a/DisCatSharp.Docs/libdev/DisCatSharp.VoiceNext/index.md b/DisCatSharp.Docs/libdev/DisCatSharp.VoiceNext/index.md
new file mode 100644
index 000000000..95fc9e082
--- /dev/null
+++ b/DisCatSharp.Docs/libdev/DisCatSharp.VoiceNext/index.md
@@ -0,0 +1,12 @@
+---
+uid: libdev_discatsharp_voicenext_index
+title: DisCatSharp.VoiceNext API Reference
+---
+
+# API Reference
+
+Welcome to the DisCatSharp.VoiceNext API reference.
+
+To begin, select a namespace, then a class, from the table of contents on the left.
+
+If you encounter any problems or see typos, please inform us on our [Discord server](https://discord.gg/Uk7sggRBTm).
diff --git a/DisCatSharp.Docs/libdev/DisCatSharp/index.md b/DisCatSharp.Docs/libdev/DisCatSharp/index.md
new file mode 100644
index 000000000..9ace17ae6
--- /dev/null
+++ b/DisCatSharp.Docs/libdev/DisCatSharp/index.md
@@ -0,0 +1,12 @@
+---
+uid: libdev_discatsharp_index
+title: DisCatSharp API Reference
+---
+
+# API Reference
+
+Welcome to the DisCatSharp API reference.
+
+To begin, select a namespace, then a class, from the table of contents on the left.
+
+If you encounter any problems or see typos, please inform us on our [Discord server](https://discord.gg/Uk7sggRBTm).
diff --git a/DisCatSharp.Docs/libdev/index.md b/DisCatSharp.Docs/libdev/index.md
new file mode 100644
index 000000000..43572829b
--- /dev/null
+++ b/DisCatSharp.Docs/libdev/index.md
@@ -0,0 +1,30 @@
+---
+uid: libdev_index
+title: DisCatSharp Library Development API
+---
+# API Reference
+
+Welcome to the DisCatSharp Library Development API reference.
+
+This documentation is intended for developers who wish to contribute to the DisCatSharp library.
+
+You find internal and private methods and properties here.
+
+
+## Main packages
+- [DisCatSharp](xref:libdev_discatsharp_index)
+- [DisCatSharp.ApplicationCommands](xref:libdev_discatsharp_applicationcommands_index)
+- [DisCatSharp.CommandsNext](xref:libdev_discatsharp_commandsnext_index)
+- [DisCatSharp.Interactivity](xref:libdev_discatsharp_interactivity_index)
+
+## Voice packages
+- [DisCatSharp.Lavalink](xref:libdev_discatsharp_lavalink_index)
+- [DisCatSharp.VoiceNext](xref:libdev_discatsharp_voicenext_index)
+
+## Hosting packages
+- [DisCatSharp.Configuration](xref:libdev_discatsharp_configuration_index)
+- [DisCatSharp.Hosting](xref:libdev_discatsharp_hosting_index)
+- [DisCatSharp.DependencyInjection](xref:libdev_discatsharp_hosting_dependencyinjection_index)
+
+## Other packages
+- [DisCatSharp.Common](xref:libdev_discatsharp_common_index)
diff --git a/DisCatSharp.Docs/libdev/toc.yml b/DisCatSharp.Docs/libdev/toc.yml
new file mode 100644
index 000000000..73874f696
--- /dev/null
+++ b/DisCatSharp.Docs/libdev/toc.yml
@@ -0,0 +1,22 @@
+- name: Intro
+ href: index.md
+- name: DisCatSharp
+ href: DisCatSharp/
+- name: DisCatSharp.ApplicationCommands
+ href: DisCatSharp.ApplicationCommands/
+- name: DisCatSharp.CommandsNext
+ href: DisCatSharp.CommandsNext/
+- name: DisCatSharp.Common
+ href: DisCatSharp.Common/
+- name: DisCatSharp.Configuration
+ href: DisCatSharp.Configuration/
+- name: DisCatSharp.Hosting
+ href: DisCatSharp.Hosting/
+- name: DisCatSharp.Hosting.DependencyInjection
+ href: DisCatSharp.Hosting.DependencyInjection/
+- name: DisCatSharp.Interactivity
+ href: DisCatSharp.Interactivity/
+- name: DisCatSharp.Lavalink
+ href: DisCatSharp.Lavalink/
+- name: DisCatSharp.VoiceNext
+ href: DisCatSharp.VoiceNext/
diff --git a/DisCatSharp.Docs/toc.yml b/DisCatSharp.Docs/toc.yml
index 6c27a4a6f..9e912f0e3 100644
--- a/DisCatSharp.Docs/toc.yml
+++ b/DisCatSharp.Docs/toc.yml
@@ -1,10 +1,12 @@
- name: Articles
href: articles/
- name: Changelogs
href: changelogs/index.md
- name: FAQ
href: faq.md
- name: API Documentation
href: api/index.md
+- name: Library Development Docs
+ href: libdev/index.md
- name: Voice Natives
href: natives/index.md
diff --git a/DisCatSharp.Hosting/Properties/AssemblyProperties.cs b/DisCatSharp.Hosting/Properties/AssemblyProperties.cs
index e0524a945..020e02337 100644
--- a/DisCatSharp.Hosting/Properties/AssemblyProperties.cs
+++ b/DisCatSharp.Hosting/Properties/AssemblyProperties.cs
@@ -1,43 +1,45 @@
// This file is part of the DisCatSharp project, based off DSharpPlus.
//
// Copyright (c) 2021-2022 AITSYS
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("DisCatSharp.ApplicationCommands")]
[assembly: InternalsVisibleTo("DisCatSharp.CommandsNext")]
[assembly: InternalsVisibleTo("DisCatSharp.Common")]
[assembly: InternalsVisibleTo("DisCatSharp.Configuration")]
[assembly: InternalsVisibleTo("DisCatSharp.Configuration.Tests")]
[assembly: InternalsVisibleTo("DisCatSharp")]
[assembly: InternalsVisibleTo("DisCatSharp.Hosting.DependencyInjection")]
[assembly: InternalsVisibleTo("DisCatSharp.Hosting.Tests")]
[assembly: InternalsVisibleTo("DisCatSharp.Interactivity")]
[assembly: InternalsVisibleTo("DisCatSharp.Lavalink")]
[assembly: InternalsVisibleTo("DisCatSharp.Phabricator")]
[assembly: InternalsVisibleTo("DisCatSharp.Support")]
[assembly: InternalsVisibleTo("DisCatSharp.Test")]
[assembly: InternalsVisibleTo("DisCatSharp.VoiceNext")]
[assembly: InternalsVisibleTo("DisCatSharp.VoiceNext.Natives")]
[assembly: InternalsVisibleTo("Nyaw")]
[assembly: InternalsVisibleTo("DisCatSharp.DevTools")]
[assembly: InternalsVisibleTo("DisCatSharp.DocsGenerator")]
[assembly: InternalsVisibleTo("DisCatSharp.StaffApps")]
+[assembly: InternalsVisibleTo("Microsoft.DocAsCode")]
+[assembly: InternalsVisibleTo("Microsoft.DocAsCode.Metadata.ManagedReference")]
diff --git a/DisCatSharp.Interactivity/Extensions/MessageExtensions.cs b/DisCatSharp.Interactivity/Extensions/MessageExtensions.cs
index 735170684..e88e95b7c 100644
--- a/DisCatSharp.Interactivity/Extensions/MessageExtensions.cs
+++ b/DisCatSharp.Interactivity/Extensions/MessageExtensions.cs
@@ -1,243 +1,244 @@
// This file is part of the DisCatSharp project, based off DSharpPlus.
//
// Copyright (c) 2021-2022 AITSYS
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Threading;
using System.Threading.Tasks;
using DisCatSharp.Entities;
+using DisCatSharp.Enums;
using DisCatSharp.EventArgs;
using DisCatSharp.Interactivity.Enums;
using DisCatSharp.Interactivity.EventHandling;
namespace DisCatSharp.Interactivity.Extensions;
///
/// Interactivity extension methods for .
///
public static class MessageExtensions
{
///
/// Waits for the next message that has the same author and channel as this message.
///
///
Original message.
///
Overrides the timeout set in
public static Task
> GetNextMessageAsync(this DiscordMessage message, TimeSpan? timeoutOverride = null)
=> message.Channel.GetNextMessageAsync(message.Author, timeoutOverride);
///
/// Waits for the next message with the same author and channel as this message, which also satisfies a predicate.
///
/// Original message.
/// A predicate that should return if a message matches.
/// Overrides the timeout set in
public static Task> GetNextMessageAsync(this DiscordMessage message, Func predicate, TimeSpan? timeoutOverride = null)
=> message.Channel.GetNextMessageAsync(msg => msg.Author.Id == message.Author.Id && message.ChannelId == msg.ChannelId && predicate(msg), timeoutOverride);
///
/// Waits for any button to be pressed on the specified message.
///
/// The message to wait on.
public static Task> WaitForButtonAsync(this DiscordMessage message)
=> GetInteractivity(message).WaitForButtonAsync(message);
///
/// Waits for any button to be pressed on the specified message.
///
/// The message to wait on.
/// Overrides the timeout set in
public static Task> WaitForButtonAsync(this DiscordMessage message, TimeSpan? timeoutOverride = null)
=> GetInteractivity(message).WaitForButtonAsync(message, timeoutOverride);
///
/// Waits for any button to be pressed on the specified message.
///
/// The message to wait on.
/// A custom cancellation token that can be cancelled at any point.
public static Task> WaitForButtonAsync(this DiscordMessage message, CancellationToken token)
=> GetInteractivity(message).WaitForButtonAsync(message, token);
///
/// Waits for a button with the specified Id to be pressed on the specified message.
///
/// The message to wait on.
/// The Id of the button to wait for.
/// Overrides the timeout set in
public static Task> WaitForButtonAsync(this DiscordMessage message, string id, TimeSpan? timeoutOverride = null)
=> GetInteractivity(message).WaitForButtonAsync(message, id, timeoutOverride);
///
/// Waits for a button with the specified Id to be pressed on the specified message.
///
/// The message to wait on.
/// The Id of the button to wait for.
/// A custom cancellation token that can be cancelled at any point.
public static Task> WaitForButtonAsync(this DiscordMessage message, string id, CancellationToken token)
=> GetInteractivity(message).WaitForButtonAsync(message, id, token);
///
/// Waits for any button to be pressed on the specified message by the specified user.
///
/// The message to wait on.
/// The user to wait for button input from.
/// Overrides the timeout set in
public static Task> WaitForButtonAsync(this DiscordMessage message, DiscordUser user, TimeSpan? timeoutOverride = null)
=> GetInteractivity(message).WaitForButtonAsync(message, user, timeoutOverride);
///
/// Waits for any button to be pressed on the specified message by the specified user.
///
/// The message to wait on.
/// The user to wait for button input from.
/// A custom cancellation token that can be cancelled at any point.
public static Task> WaitForButtonAsync(this DiscordMessage message, DiscordUser user, CancellationToken token)
=> GetInteractivity(message).WaitForButtonAsync(message, user, token);
///
/// Waits for any button to be interacted with.
///
/// The message to wait on.
/// The predicate to filter interactions by.
/// Override the timeout specified in
public static Task> WaitForButtonAsync(this DiscordMessage message, Func predicate, TimeSpan? timeoutOverride = null)
=> GetInteractivity(message).WaitForButtonAsync(message, predicate, timeoutOverride);
///
/// Waits for any button to be interacted with.
///
/// The message to wait on.
/// The predicate to filter interactions by.
/// A token to cancel interactivity with at any time. Pass to wait indefinitely.
public static Task> WaitForButtonAsync(this DiscordMessage message, Func predicate, CancellationToken token)
=> GetInteractivity(message).WaitForButtonAsync(message, predicate, token);
///
/// Waits for any dropdown to be interacted with.
///
/// The message to wait for.
/// A filter predicate.
/// Override the timeout period specified in .
/// Thrown when the message doesn't contain any dropdowns
- public static Task> WaitForSelectAsync(this DiscordMessage message, Func predicate, TimeSpan? timeoutOverride = null)
- => GetInteractivity(message).WaitForSelectAsync(message, predicate, timeoutOverride);
+ public static Task> WaitForSelectAsync(this DiscordMessage message, Func predicate, ComponentType selectType, TimeSpan? timeoutOverride = null)
+ => GetInteractivity(message).WaitForSelectAsync(message, predicate, selectType, timeoutOverride);
///
/// Waits for any dropdown to be interacted with.
///
/// The message to wait for.
/// A filter predicate.
/// A token that can be used to cancel interactivity. Pass to wait indefinitely.
/// Thrown when the message doesn't contain any dropdowns
- public static Task> WaitForSelectAsync(this DiscordMessage message, Func predicate, CancellationToken token)
- => GetInteractivity(message).WaitForSelectAsync(message, predicate, token);
+ public static Task> WaitForSelectAsync(this DiscordMessage message, Func predicate, ComponentType selectType, CancellationToken token)
+ => GetInteractivity(message).WaitForSelectAsync(message, predicate, selectType, token);
///
/// Waits for a dropdown to be interacted with.
///
/// The message to wait on.
/// The Id of the dropdown to wait for.
/// Overrides the timeout set in
- public static Task> WaitForSelectAsync(this DiscordMessage message, string id, TimeSpan? timeoutOverride = null)
- => GetInteractivity(message).WaitForSelectAsync(message, id, timeoutOverride);
+ public static Task> WaitForSelectAsync(this DiscordMessage message, string id, ComponentType selectType, TimeSpan? timeoutOverride = null)
+ => GetInteractivity(message).WaitForSelectAsync(message, id, selectType, timeoutOverride);
///
/// Waits for a dropdown to be interacted with.
///
/// The message to wait on.
/// The Id of the dropdown to wait for.
/// A custom cancellation token that can be cancelled at any point.
- public static Task> WaitForSelectAsync(this DiscordMessage message, string id, CancellationToken token)
- => GetInteractivity(message).WaitForSelectAsync(message, id, token);
+ public static Task> WaitForSelectAsync(this DiscordMessage message, string id, ComponentType selectType, CancellationToken token)
+ => GetInteractivity(message).WaitForSelectAsync(message, id, selectType, token);
///
/// Waits for a dropdown to be interacted with by the specified user.
///
/// The message to wait on.
/// The user to wait for.
/// The Id of the dropdown to wait for.
///
- public static Task> WaitForSelectAsync(this DiscordMessage message, DiscordUser user, string id, TimeSpan? timeoutOverride = null)
- => GetInteractivity(message).WaitForSelectAsync(message, user, id, timeoutOverride);
+ public static Task> WaitForSelectAsync(this DiscordMessage message, DiscordUser user, string id, ComponentType selectType, TimeSpan? timeoutOverride = null)
+ => GetInteractivity(message).WaitForSelectAsync(message, user, id, selectType, timeoutOverride);
///
/// Waits for a dropdown to be interacted with by the specified user.
///
/// The message to wait on.
/// The user to wait for.
/// The Id of the dropdown to wait for.
/// A custom cancellation token that can be cancelled at any point.
- public static Task> WaitForSelectAsync(this DiscordMessage message, DiscordUser user, string id, CancellationToken token)
- => GetInteractivity(message).WaitForSelectAsync(message, user, id, token);
+ public static Task> WaitForSelectAsync(this DiscordMessage message, DiscordUser user, string id, ComponentType selectType, CancellationToken token)
+ => GetInteractivity(message).WaitForSelectAsync(message, user, id, selectType, token);
///
/// Waits for a reaction on this message from a specific user.
///
/// Target message.
/// The target user.
/// Overrides the timeout set in
/// Thrown if interactivity is not enabled for the client associated with the message.
public static Task> WaitForReactionAsync(this DiscordMessage message, DiscordUser user, TimeSpan? timeoutOverride = null)
=> GetInteractivity(message).WaitForReactionAsync(message, user, timeoutOverride);
///
/// Waits for a specific reaction on this message from the specified user.
///
/// Target message.
/// The target user.
/// The target emoji.
/// Overrides the timeout set in
/// Thrown if interactivity is not enabled for the client associated with the message.
public static Task> WaitForReactionAsync(this DiscordMessage message, DiscordUser user, DiscordEmoji emoji, TimeSpan? timeoutOverride = null)
=> GetInteractivity(message).WaitForReactionAsync(e => e.Emoji == emoji, message, user, timeoutOverride);
///
/// Collects all reactions on this message within the timeout duration.
///
/// The message to collect reactions from.
/// Overrides the timeout set in
/// Thrown if interactivity is not enabled for the client associated with the message.
public static Task> CollectReactionsAsync(this DiscordMessage message, TimeSpan? timeoutOverride = null)
=> GetInteractivity(message).CollectReactionsAsync(message, timeoutOverride);
///
/// Begins a poll using this message.
///
/// Target message.
/// Options for this poll.
/// Overrides the action set in
/// Overrides the timeout set in
/// Thrown if interactivity is not enabled for the client associated with the message.
public static Task> DoPollAsync(this DiscordMessage message, IEnumerable emojis, PollBehaviour? behaviorOverride = null, TimeSpan? timeoutOverride = null)
=> GetInteractivity(message).DoPollAsync(message, emojis, behaviorOverride, timeoutOverride);
///
/// Retrieves an interactivity instance from a message instance.
///
internal static InteractivityExtension GetInteractivity(DiscordMessage message)
{
var client = (DiscordClient)message.Discord;
var interactivity = client.GetInteractivity();
return interactivity ?? throw new InvalidOperationException($"Interactivity is not enabled for this {(client.IsShard ? "shard" : "client")}.");
}
}
diff --git a/DisCatSharp.Interactivity/InteractivityExtension.cs b/DisCatSharp.Interactivity/InteractivityExtension.cs
index c0fa81fed..479973a02 100644
--- a/DisCatSharp.Interactivity/InteractivityExtension.cs
+++ b/DisCatSharp.Interactivity/InteractivityExtension.cs
@@ -1,971 +1,971 @@
// This file is part of the DisCatSharp project, based off DSharpPlus.
//
// Copyright (c) 2021-2022 AITSYS
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using DisCatSharp.Common.Utilities;
using DisCatSharp.Entities;
using DisCatSharp.Enums;
using DisCatSharp.EventArgs;
using DisCatSharp.Interactivity.Enums;
using DisCatSharp.Interactivity.EventHandling;
namespace DisCatSharp.Interactivity;
///
/// Extension class for DisCatSharp.Interactivity
///
public class InteractivityExtension : BaseExtension
{
///
/// Gets the config.
///
internal InteractivityConfiguration Config { get; }
private EventWaiter _messageCreatedWaiter;
private EventWaiter _messageReactionAddWaiter;
private EventWaiter _typingStartWaiter;
private EventWaiter _modalInteractionWaiter;
private EventWaiter _componentInteractionWaiter;
private ComponentEventWaiter _componentEventWaiter;
private ModalEventWaiter _modalEventWaiter;
private ReactionCollector _reactionCollector;
private Poller _poller;
private Paginator _paginator;
private ComponentPaginator _compPaginator;
///
/// Initializes a new instance of the class.
///
/// The configuration.
internal InteractivityExtension(InteractivityConfiguration cfg)
{
this.Config = new InteractivityConfiguration(cfg);
}
///
/// Setups the Interactivity Extension.
///
/// Discord client.
protected internal override void Setup(DiscordClient client)
{
this.Client = client;
this._messageCreatedWaiter = new EventWaiter(this.Client);
this._messageReactionAddWaiter = new EventWaiter(this.Client);
this._componentInteractionWaiter = new EventWaiter(this.Client);
this._modalInteractionWaiter = new EventWaiter(this.Client);
this._typingStartWaiter = new EventWaiter(this.Client);
this._poller = new Poller(this.Client);
this._reactionCollector = new ReactionCollector(this.Client);
this._paginator = new Paginator(this.Client);
this._compPaginator = new ComponentPaginator(this.Client, this.Config);
this._componentEventWaiter = new ComponentEventWaiter(this.Client, this.Config);
this._modalEventWaiter = new ModalEventWaiter(this.Client, this.Config);
}
///
/// Makes a poll and returns poll results.
///
/// Message to create poll on.
/// Emojis to use for this poll.
/// What to do when the poll ends.
/// Override timeout period.
///
public async Task> DoPollAsync(DiscordMessage m, IEnumerable emojis, PollBehaviour? behaviour = default, TimeSpan? timeout = null)
{
if (!Utilities.HasReactionIntents(this.Client.Configuration.Intents))
throw new InvalidOperationException("No reaction intents are enabled.");
if (!emojis.Any())
throw new ArgumentException("You need to provide at least one emoji for a poll!");
foreach (var em in emojis)
await m.CreateReactionAsync(em).ConfigureAwait(false);
var res = await this._poller.DoPollAsync(new PollRequest(m, timeout ?? this.Config.Timeout, emojis)).ConfigureAwait(false);
var pollBehaviour = behaviour ?? this.Config.PollBehaviour;
var thisMember = await m.Channel.Guild.GetMemberAsync(this.Client.CurrentUser.Id).ConfigureAwait(false);
if (pollBehaviour == PollBehaviour.DeleteEmojis && m.Channel.PermissionsFor(thisMember).HasPermission(Permissions.ManageMessages))
await m.DeleteAllReactionsAsync().ConfigureAwait(false);
return new ReadOnlyCollection(res.ToList());
}
///
/// Waits for any button in the specified collection to be pressed.
///
/// The message to wait on.
/// A collection of buttons to listen for.
/// Override the timeout period in .
/// A with the result of button that was pressed, if any.
/// Thrown when attempting to wait for a message that is not authored by the current user.
/// Thrown when the message does not contain a button with the specified Id, or any buttons at all.
public Task> WaitForButtonAsync(DiscordMessage message, IEnumerable buttons, TimeSpan? timeoutOverride = null)
=> this.WaitForButtonAsync(message, buttons, this.GetCancellationToken(timeoutOverride));
///
/// Waits for any button in the specified collection to be pressed.
///
/// The message to wait on.
/// A collection of buttons to listen for.
/// A custom cancellation token that can be cancelled at any point.
/// A with the result of button that was pressed, if any.
/// Thrown when attempting to wait for a message that is not authored by the current user.
/// Thrown when the message does not contain a button with the specified Id, or any buttons at all.
public async Task> WaitForButtonAsync(DiscordMessage message, IEnumerable buttons, CancellationToken token)
{
if (message.Author != this.Client.CurrentUser)
throw new InvalidOperationException("Interaction events are only sent to the application that created them.");
if (!buttons.Any())
throw new ArgumentException("You must specify at least one button to listen for.");
if (!message.Components.Any())
throw new ArgumentException("Provided message does not contain any components.");
if (!message.Components.SelectMany(c => c.Components).Any(c => c.Type is ComponentType.Button))
throw new ArgumentException("Provided Message does not contain any button components.");
var res = await this._componentEventWaiter
.WaitForMatchAsync(new ComponentMatchRequest(message,
c =>
c.Interaction.Data.ComponentType == ComponentType.Button &&
buttons.Any(b => b.CustomId == c.Id), token)).ConfigureAwait(false);
return new InteractivityResult(res is null, res);
}
///
/// Waits for a user modal submit.
///
/// The custom id of the modal to wait for.
/// Override the timeout period specified in .
/// A with the result of the modal.
public Task> WaitForModalAsync(string customId, TimeSpan? timeoutOverride = null)
=> this.WaitForModalAsync(customId, this.GetCancellationToken(timeoutOverride));
///
/// Waits for a user modal submit.
///
/// The custom id of the modal to wait for.
/// A custom cancellation token that can be cancelled at any point.
/// A with the result of the modal.
public async Task> WaitForModalAsync(string customId, CancellationToken token)
{
var result =
await this
._modalEventWaiter
.WaitForModalMatchAsync(new ModalMatchRequest(customId, c => c.Interaction.Type == InteractionType.ModalSubmit, token))
.ConfigureAwait(false);
return new InteractivityResult(result is null, result);
}
///
/// Waits for any button on the specified message to be pressed.
///
/// The message to wait for the button on.
/// Override the timeout period specified in .
/// A with the result of button that was pressed, if any.
/// Thrown when attempting to wait for a message that is not authored by the current user.
/// Thrown when the message does not contain a button with the specified Id, or any buttons at all.
public Task> WaitForButtonAsync(DiscordMessage message, TimeSpan? timeoutOverride = null)
=> this.WaitForButtonAsync(message, this.GetCancellationToken(timeoutOverride));
///
/// Waits for any button on the specified message to be pressed.
///
/// The message to wait for the button on.
/// A custom cancellation token that can be cancelled at any point.
/// A with the result of button that was pressed, if any.
/// Thrown when attempting to wait for a message that is not authored by the current user.
/// Thrown when the message does not contain a button with the specified Id, or any buttons at all.
public async Task> WaitForButtonAsync(DiscordMessage message, CancellationToken token)
{
if (message.Author != this.Client.CurrentUser)
throw new InvalidOperationException("Interaction events are only sent to the application that created them.");
if (!message.Components.Any())
throw new ArgumentException("Provided message does not contain any components.");
if (!message.Components.SelectMany(c => c.Components).Any(c => c.Type is ComponentType.Button))
throw new ArgumentException("Message does not contain any button components.");
var ids = message.Components.SelectMany(m => m.Components).Select(c => c.CustomId);
var result =
await this
._componentEventWaiter
.WaitForMatchAsync(new ComponentMatchRequest(message, c => c.Interaction.Data.ComponentType == ComponentType.Button && ids.Contains(c.Id), token))
.ConfigureAwait(false);
return new InteractivityResult(result is null, result);
}
///
/// Waits for any button on the specified message to be pressed by the specified user.
///
/// The message to wait for the button on.
/// The user to wait for the button press from.
/// Override the timeout period specified in .
/// A with the result of button that was pressed, if any.
/// Thrown when attempting to wait for a message that is not authored by the current user.
/// Thrown when the message does not contain a button with the specified Id, or any buttons at all.
public Task> WaitForButtonAsync(DiscordMessage message, DiscordUser user, TimeSpan? timeoutOverride = null)
=> this.WaitForButtonAsync(message, user, this.GetCancellationToken(timeoutOverride));
///
/// Waits for any button on the specified message to be pressed by the specified user.
///
/// The message to wait for the button on.
/// The user to wait for the button press from.
/// A custom cancellation token that can be cancelled at any point.
/// A with the result of button that was pressed, if any.
/// Thrown when attempting to wait for a message that is not authored by the current user.
/// Thrown when the message does not contain a button with the specified Id, or any buttons at all.
public async Task> WaitForButtonAsync(DiscordMessage message, DiscordUser user, CancellationToken token)
{
if (message.Author != this.Client.CurrentUser)
throw new InvalidOperationException("Interaction events are only sent to the application that created them.");
if (!message.Components.Any())
throw new ArgumentException("Provided message does not contain any components.");
if (!message.Components.SelectMany(c => c.Components).Any(c => c.Type is ComponentType.Button))
throw new ArgumentException("Message does not contain any button components.");
var result = await this
._componentEventWaiter
.WaitForMatchAsync(new ComponentMatchRequest(message, (c) => c.Interaction.Data.ComponentType is ComponentType.Button && c.User == user, token))
.ConfigureAwait(false);
return new InteractivityResult(result is null, result);
}
///
/// Waits for a button with the specified Id to be pressed.
///
/// The message to wait for the button on.
/// The Id of the button to wait for.
/// Override the timeout period specified in .
/// A with the result of the operation.
/// Thrown when attempting to wait for a message that is not authored by the current user.
/// Thrown when the message does not contain a button with the specified Id, or any buttons at all.
public Task> WaitForButtonAsync(DiscordMessage message, string id, TimeSpan? timeoutOverride = null)
=> this.WaitForButtonAsync(message, id, this.GetCancellationToken(timeoutOverride));
///
/// Waits for a button with the specified Id to be pressed.
///
/// The message to wait for the button on.
/// The Id of the button to wait for.
/// Override the timeout period specified in .
/// A with the result of the operation.
/// Thrown when attempting to wait for a message that is not authored by the current user.
/// Thrown when the message does not contain a button with the specified Id, or any buttons at all.
public async Task> WaitForButtonAsync(DiscordMessage message, string id, CancellationToken token)
{
if (message.Author != this.Client.CurrentUser)
throw new InvalidOperationException("Interaction events are only sent to the application that created them.");
if (!message.Components.Any())
throw new ArgumentException("Provided message does not contain any components.");
if (!message.Components.SelectMany(c => c.Components).Any(c => c.Type is ComponentType.Button))
throw new ArgumentException("Message does not contain any button components.");
if (!message.Components.SelectMany(c => c.Components).OfType().Any(c => c.CustomId == id))
throw new ArgumentException($"Message does not contain button with Id of '{id}'.");
var result = await this
._componentEventWaiter
.WaitForMatchAsync(new ComponentMatchRequest(message, (c) => c.Interaction.Data.ComponentType is ComponentType.Button && c.Id == id, token))
.ConfigureAwait(false);
return new InteractivityResult(result is null, result);
}
///
/// Waits for any button to be interacted with.
///
/// The message to wait on.
/// The predicate to filter interactions by.
/// Override the timeout specified in
public Task> WaitForButtonAsync(DiscordMessage message, Func predicate, TimeSpan? timeoutOverride = null)
=> this.WaitForButtonAsync(message, predicate, this.GetCancellationToken(timeoutOverride));
///
/// Waits for any button to be interacted with.
///
/// The message to wait on.
/// The predicate to filter interactions by.
/// A token to cancel interactivity with at any time. Pass to wait indefinitely.
public async Task> WaitForButtonAsync(DiscordMessage message, Func predicate, CancellationToken token)
{
if (message.Author != this.Client.CurrentUser)
throw new InvalidOperationException("Interaction events are only sent to the application that created them.");
if (!message.Components.Any())
throw new ArgumentException("Provided message does not contain any components.");
if (!message.Components.SelectMany(c => c.Components).Any(c => c.Type is ComponentType.Button))
throw new ArgumentException("Message does not contain any button components.");
var result = await this
._componentEventWaiter
.WaitForMatchAsync(new ComponentMatchRequest(message, c => c.Interaction.Data.ComponentType is ComponentType.Button && predicate(c), token))
.ConfigureAwait(false);
return new InteractivityResult(result is null, result);
}
///
/// Waits for any dropdown to be interacted with.
///
/// The message to wait for.
/// A filter predicate.
/// Override the timeout period specified in .
/// Thrown when the Provided message does not contain any dropdowns
- public Task> WaitForSelectAsync(DiscordMessage message, Func predicate, TimeSpan? timeoutOverride = null)
- => this.WaitForSelectAsync(message, predicate, this.GetCancellationToken(timeoutOverride));
+ public Task> WaitForSelectAsync(DiscordMessage message, Func predicate, ComponentType selectType, TimeSpan? timeoutOverride = null)
+ => this.WaitForSelectAsync(message, predicate, selectType, this.GetCancellationToken(timeoutOverride));
///
/// Waits for any dropdown to be interacted with.
///
/// The message to wait for.
/// A filter predicate.
/// A token that can be used to cancel interactivity. Pass to wait indefinitely.
/// Thrown when the Provided message does not contain any dropdowns
- public async Task> WaitForSelectAsync(DiscordMessage message, Func predicate, CancellationToken token)
+ public async Task> WaitForSelectAsync(DiscordMessage message, Func predicate, ComponentType selectType, CancellationToken token)
{
if (message.Author != this.Client.CurrentUser)
throw new InvalidOperationException("Interaction events are only sent to the application that created them.");
if (!message.Components.Any())
throw new ArgumentException("Provided message does not contain any components.");
- if (!message.Components.SelectMany(c => c.Components).Any(c => c.Type is ComponentType.Select))
+ if (!message.Components.SelectMany(c => c.Components).Any(c => c.Type == selectType))
throw new ArgumentException("Message does not contain any select components.");
var result = await this
._componentEventWaiter
- .WaitForMatchAsync(new ComponentMatchRequest(message, c => c.Interaction.Data.ComponentType is ComponentType.Select && predicate(c), token))
+ .WaitForMatchAsync(new ComponentMatchRequest(message, c => c.Interaction.Data.ComponentType == selectType && predicate(c), token))
.ConfigureAwait(false);
return new InteractivityResult(result is null, result);
}
///
/// Waits for a dropdown to be interacted with.
///
/// This is here for backwards-compatibility and will internally create a cancellation token.
/// The message to wait on.
/// The Id of the dropdown to wait on.
/// Override the timeout period specified in .
/// Thrown when the message does not have any dropdowns or any dropdown with the specified Id.
- public Task> WaitForSelectAsync(DiscordMessage message, string id, TimeSpan? timeoutOverride = null)
- => this.WaitForSelectAsync(message, id, this.GetCancellationToken(timeoutOverride));
+ public Task> WaitForSelectAsync(DiscordMessage message, string id, ComponentType selectType, TimeSpan? timeoutOverride = null)
+ => this.WaitForSelectAsync(message, id, selectType, this.GetCancellationToken(timeoutOverride));
///
/// Waits for a dropdown to be interacted with.
///
/// The message to wait on.
/// The Id of the dropdown to wait on.
/// A custom cancellation token that can be cancelled at any point.
/// Thrown when the message does not have any dropdowns or any dropdown with the specified Id.
- public async Task> WaitForSelectAsync(DiscordMessage message, string id, CancellationToken token)
+ public async Task