|
5 | 5 | namespace DisCatSharp.ApplicationCommands;
|
6 | 6 |
|
7 | 7 | /// <summary>
|
8 |
| -/// A configuration for a <see cref="ApplicationCommandsExtension"/> |
| 8 | +/// A configuration for a <see cref="ApplicationCommandsExtension" /> |
9 | 9 | /// </summary>
|
10 | 10 | public sealed class ApplicationCommandsConfiguration
|
11 | 11 | {
|
12 | 12 | /// <summary>
|
13 |
| - /// <para>Sets the service provider.</para> |
14 |
| - /// <para>Objects in this provider are used when instantiating application command modules.</para> |
15 |
| - /// <para>This allows passing data around without resorting to static members.</para> |
16 |
| - /// <para>Defaults to <see langword="null"/>.</para> |
| 13 | + /// Creates a new configuration with default values. |
| 14 | + /// </summary> |
| 15 | + public ApplicationCommandsConfiguration() |
| 16 | + { } |
| 17 | + |
| 18 | + /// <summary> |
| 19 | + /// Utilized via dependency injection pipeline. |
| 20 | + /// </summary> |
| 21 | + /// <param name="provider">The service provider.</param> |
| 22 | + [ActivatorUtilitiesConstructor] |
| 23 | + public ApplicationCommandsConfiguration(IServiceProvider provider) |
| 24 | + { |
| 25 | + this.ServiceProvider = provider; |
| 26 | + } |
| 27 | + |
| 28 | + /// <summary> |
| 29 | + /// Creates a new instance of <see cref="ApplicationCommandsConfiguration" />, copying the properties of another |
| 30 | + /// configuration. |
| 31 | + /// </summary> |
| 32 | + /// <param name="acc">Configuration the properties of which are to be copied.</param> |
| 33 | + public ApplicationCommandsConfiguration(ApplicationCommandsConfiguration acc) |
| 34 | + { |
| 35 | + this.EnableDefaultHelp = acc.EnableDefaultHelp; |
| 36 | + this.ServiceProvider = acc.ServiceProvider; |
| 37 | + this.DebugStartup = acc.DebugStartup; |
| 38 | + this.CheckAllGuilds = acc.CheckAllGuilds; |
| 39 | + this.AutoDefer = acc.AutoDefer; |
| 40 | + this.EnableLocalization = acc.EnableLocalization; |
| 41 | + this.GenerateTranslationFilesOnly = acc.GenerateTranslationFilesOnly; |
| 42 | + this.EnableDefaultUserAppsHelp = acc.EnableDefaultUserAppsHelp; |
| 43 | + this.UnitTestMode = acc.UnitTestMode; |
| 44 | + } |
| 45 | + |
| 46 | + /// <summary> |
| 47 | + /// <para>Sets the service provider.</para> |
| 48 | + /// <para>Objects in this provider are used when instantiating application command modules.</para> |
| 49 | + /// <para>This allows passing data around without resorting to static members.</para> |
| 50 | + /// <para>Defaults to <see langword="null" />.</para> |
17 | 51 | /// </summary>
|
18 | 52 | public IServiceProvider ServiceProvider { internal get; set; } = new ServiceCollection().BuildServiceProvider(true);
|
19 | 53 |
|
20 | 54 | /// <summary>
|
21 |
| - /// <para>This option enables the default help command.</para> |
22 |
| - /// <para>Disabling this will allow you to make your own help command.</para> |
23 |
| - /// <para>Defaults to <see langword="true"/>.</para> |
| 55 | + /// <para>This option enables the default help command.</para> |
| 56 | + /// <para>Disabling this will allow you to make your own help command.</para> |
| 57 | + /// <para>Defaults to <see langword="true" />.</para> |
24 | 58 | /// </summary>
|
25 | 59 | public bool EnableDefaultHelp { internal get; set; } = true;
|
26 | 60 |
|
27 | 61 | /// <summary>
|
28 |
| - /// <para>This option enables the default help command with user apps capability.</para> |
29 |
| - /// <para>Mutually exclusive with <see cref="EnableDefaultHelp"/>.</para> |
30 |
| - /// <para>Defaults to <see langword="false"/>.</para> |
| 62 | + /// <para>This option enables the default help command with user apps capability.</para> |
| 63 | + /// <para>Mutually exclusive with <see cref="EnableDefaultHelp" />.</para> |
| 64 | + /// <para>Defaults to <see langword="false" />.</para> |
31 | 65 | /// </summary>
|
32 | 66 | public bool EnableDefaultUserAppsHelp { get; set; } = false;
|
33 | 67 |
|
34 | 68 | /// <summary>
|
35 |
| - /// This option enables the localization feature. |
36 |
| - /// <para>Defaults to <see langword="false"/>.</para> |
| 69 | + /// This option enables the localization feature. |
| 70 | + /// <para>Defaults to <see langword="false" />.</para> |
37 | 71 | /// </summary>
|
38 | 72 | public bool EnableLocalization { internal get; set; } = false;
|
39 | 73 |
|
40 | 74 | // TODO: Check if it interferes with callback hints
|
41 | 75 | /// <summary>
|
42 |
| - /// <para>Automatically defer all responses.</para> |
43 |
| - /// <note type="note">If you enable this, you can't use CreateResponse. Use EditResponse instead.</note> |
44 |
| - /// <para>Defaults to <see langword="false"/>.</para> |
| 76 | + /// <para>Automatically defer all responses.</para> |
| 77 | + /// <note type="note">If you enable this, you can't use CreateResponse. Use EditResponse instead.</note> |
| 78 | + /// <para>Defaults to <see langword="false" />.</para> |
45 | 79 | /// </summary>
|
46 | 80 | public bool AutoDefer { internal get; set; } = false;
|
47 | 81 |
|
48 | 82 | /// <summary>
|
49 |
| - /// <para>This option informs the module to check through all guilds whether the |
50 |
| - /// <see target="_blank" alt="Application Commands Scope" href="https://discord.com/developers/docs/topics/oauth2#shared-resources-oauth2-scopes">application.commands</see> scope is set.</para> |
51 |
| - /// <note type="warning">This will take quite a while, when the bot is on more than 1k guilds.</note> |
52 |
| - /// <para>Defaults to <see langword="false"/>.</para> |
| 83 | + /// <para> |
| 84 | + /// This option informs the module to check through all guilds whether the |
| 85 | + /// <see target="_blank" alt="Application Commands Scope" |
| 86 | + /// href="https://discord.com/developers/docs/topics/oauth2#shared-resources-oauth2-scopes"> |
| 87 | + /// application.commands |
| 88 | + /// </see> |
| 89 | + /// scope is set. |
| 90 | + /// </para> |
| 91 | + /// <note type="warning">This will take quite a while, when the bot is on more than 1k guilds.</note> |
| 92 | + /// <para>Defaults to <see langword="false" />.</para> |
53 | 93 | /// </summary>
|
54 | 94 | public bool CheckAllGuilds { internal get; set; } = false;
|
55 | 95 |
|
56 | 96 | /// <summary>
|
57 |
| - /// <para>This option increases the debug output of the module.</para> |
58 |
| - /// <note type="warning"> |
59 |
| - /// <para>This is not recommended for production use.</para> |
60 |
| - /// <para>Enable this option only if DisCatSharp support advises you to do so.</para> |
61 |
| - /// </note> |
62 |
| - /// <para>Defaults to <see langword="false"/>.</para> |
| 97 | + /// <para>This option increases the debug output of the module.</para> |
| 98 | + /// <note type="warning"> |
| 99 | + /// <para>This is not recommended for production use.</para> |
| 100 | + /// <para>Enable this option only if DisCatSharp support advises you to do so.</para> |
| 101 | + /// </note> |
| 102 | + /// <para>Defaults to <see langword="false" />.</para> |
63 | 103 | /// </summary>
|
64 | 104 | public bool DebugStartup { internal get; set; } = false;
|
65 | 105 |
|
66 | 106 | /// <summary>
|
67 |
| - /// <para>Whether to only generate translations files and abort after that.</para> |
68 |
| - /// <para>Defaults to <see langword="false"/>.</para> |
| 107 | + /// <para>Whether to only generate translations files and abort after that.</para> |
| 108 | + /// <para>Defaults to <see langword="false" />.</para> |
69 | 109 | /// </summary>
|
70 | 110 | public bool GenerateTranslationFilesOnly { internal get; set; } = false;
|
71 | 111 |
|
72 | 112 | /// <summary>
|
73 |
| - /// Whether to enable unit test mode. |
| 113 | + /// Whether to enable unit test mode. |
74 | 114 | /// </summary>
|
75 | 115 | internal bool UnitTestMode { get; set; } = false;
|
76 |
| - |
77 |
| - /// <summary> |
78 |
| - /// Creates a new configuration with default values. |
79 |
| - /// </summary> |
80 |
| - public ApplicationCommandsConfiguration() |
81 |
| - { } |
82 |
| - |
83 |
| - /// <summary> |
84 |
| - /// Utilized via dependency injection pipeline. |
85 |
| - /// </summary> |
86 |
| - /// <param name="provider">The service provider.</param> |
87 |
| - [ActivatorUtilitiesConstructor] |
88 |
| - public ApplicationCommandsConfiguration(IServiceProvider provider) |
89 |
| - { |
90 |
| - this.ServiceProvider = provider; |
91 |
| - } |
92 |
| - |
93 |
| - /// <summary> |
94 |
| - /// Creates a new instance of <see cref="ApplicationCommandsConfiguration"/>, copying the properties of another configuration. |
95 |
| - /// </summary> |
96 |
| - /// <param name="acc">Configuration the properties of which are to be copied.</param> |
97 |
| - public ApplicationCommandsConfiguration(ApplicationCommandsConfiguration acc) |
98 |
| - { |
99 |
| - this.EnableDefaultHelp = acc.EnableDefaultHelp; |
100 |
| - this.ServiceProvider = acc.ServiceProvider; |
101 |
| - this.DebugStartup = acc.DebugStartup; |
102 |
| - this.CheckAllGuilds = acc.CheckAllGuilds; |
103 |
| - this.AutoDefer = acc.AutoDefer; |
104 |
| - this.EnableLocalization = acc.EnableLocalization; |
105 |
| - this.GenerateTranslationFilesOnly = acc.GenerateTranslationFilesOnly; |
106 |
| - this.EnableDefaultUserAppsHelp = acc.EnableDefaultUserAppsHelp; |
107 |
| - this.UnitTestMode = acc.UnitTestMode; |
108 |
| - } |
109 | 116 | }
|
0 commit comments