|
10 | 10 | using System.Text.Json; |
11 | 11 | using System.Threading.Tasks; |
12 | 12 | using System.Xml; |
| 13 | +using static System.Net.WebRequestMethods; |
13 | 14 |
|
14 | 15 | namespace Amino.Interactions |
15 | 16 | { |
16 | 17 | public partial class InteractionsClient |
17 | 18 | { |
18 | 19 |
|
| 20 | + /// <summary> |
| 21 | + /// A Dictionary of all currently registered Modules, stored as: commandName:InteactionModule |
| 22 | + /// </summary> |
19 | 23 | public Dictionary<string, Objects.InteractionModule> InteractionModules; |
| 24 | + /// <summary> |
| 25 | + /// A Queue for all currently Queued up interactions, this is only useful if <see cref="AutoHandleInteractions"/> is checked |
| 26 | + /// </summary> |
20 | 27 | public Queue<Objects.Interaction> InteractionQueue; |
21 | 28 |
|
| 29 | + /// <summary> |
| 30 | + /// An enum type of all LogLevels you can choose for you InteractionsClient |
| 31 | + /// </summary> |
22 | 32 | public enum LogLevels |
23 | 33 | { |
| 34 | + /// <summary> |
| 35 | + /// Indicates that no Logging is being done |
| 36 | + /// </summary> |
24 | 37 | None = 0, |
| 38 | + /// <summary> |
| 39 | + /// Indicates that you want to receive all log events |
| 40 | + /// </summary> |
25 | 41 | Debug = 1, |
| 42 | + /// <summary> |
| 43 | + /// Indicates that you want to receive only Warnings |
| 44 | + /// </summary> |
26 | 45 | Warning = 2, |
| 46 | + /// <summary> |
| 47 | + /// Indicates that you want to receive only Errors |
| 48 | + /// </summary> |
27 | 49 | Error = 3 |
28 | 50 | } |
29 | 51 |
|
30 | 52 | private Amino.Client AminoClient; |
| 53 | + |
| 54 | + /// <summary> |
| 55 | + /// The cooldown for your <see cref="InteractionQueue"/>, only useful if <see cref="AutoHandleInteractions"/> is checked |
| 56 | + /// </summary> |
| 57 | + /// <remarks>Note: You can currently not edit the property as the Automatic interaction queue is not implemented</remarks> |
31 | 58 | public int InteractionCooldown { get; } = 2000; |
| 59 | + /// <summary> |
| 60 | + /// This sets the Prefix for your commands, default is / |
| 61 | + /// </summary> |
32 | 62 | public string InteractionPrefix = "/"; |
33 | 63 |
|
| 64 | + /// <summary> |
| 65 | + /// This determines if the InteractionsClient should ignore its own interactions, default is true |
| 66 | + /// </summary> |
34 | 67 | public bool IgnoreSelf = true; |
| 68 | + |
| 69 | + /// <summary> |
| 70 | + /// The LogLevel you set for the <see cref="Log"/> event |
| 71 | + /// </summary> |
35 | 72 | public LogLevels LogLevel = LogLevels.None; |
36 | | - public bool AutoHandleInteractions { get; } = false; |
37 | 73 |
|
| 74 | + /// <summary> |
| 75 | + /// This determines if your Interactions should be automatically handled, the default is false |
| 76 | + /// </summary> |
| 77 | + /// <remarks>Note: You can currently not edit the property as the Automatic interaction queue is not implemented</remarks> |
| 78 | + public bool AutoHandleInteractions { get; } = false; |
38 | 79 |
|
| 80 | + /// <summary> |
| 81 | + /// The event that fires when an Interaction is detected |
| 82 | + /// </summary> |
39 | 83 | public event Action<Interaction> InteractionCreated; |
| 84 | + /// <summary> |
| 85 | + /// The event that fires when a Log is created |
| 86 | + /// </summary> |
40 | 87 | public event Action<LogMessage> Log; |
41 | 88 |
|
42 | 89 |
|
| 90 | + /// <summary> |
| 91 | + /// The contructor of your InteractionsClient |
| 92 | + /// </summary> |
| 93 | + /// <param name="client">Your <see cref="Amino.Client"/> you want to use for this InteractionsClient, note that you should not turn off the websocket and that you must be logged in</param> |
43 | 94 | public InteractionsClient(Amino.Client client) |
44 | 95 | { |
45 | 96 | this.AminoClient = client; |
@@ -81,7 +132,10 @@ private void HandleMessageSocket(Amino.Objects.Message message) |
81 | 132 | } |
82 | 133 | } |
83 | 134 |
|
84 | | - |
| 135 | + /// <summary> |
| 136 | + /// This function registers a single module into <see cref="InteractionModules"/> |
| 137 | + /// </summary> |
| 138 | + /// <typeparam name="T">Any Class / Module that has a valid structure, see <seealso href="https://github.com/Amino-NET-Group/Amino.NET.Interactions"/> to see how it works</typeparam> |
85 | 139 | public Task RegisterModule<T>() where T : InteractionBase |
86 | 140 | { |
87 | 141 | Type moduleType = typeof(T); |
@@ -135,7 +189,10 @@ public Task RegisterModule<T>() where T : InteractionBase |
135 | 189 | } |
136 | 190 |
|
137 | 191 |
|
138 | | - |
| 192 | + /// <summary> |
| 193 | + /// Registers all valid Modules of a given <see cref="Assembly"/> |
| 194 | + /// </summary> |
| 195 | + /// <param name="entrypoint">The Assembly you are passing in</param> |
139 | 196 | public Task RegisterModules(Assembly entrypoint) |
140 | 197 | { |
141 | 198 | var moduleTypes = entrypoint.GetTypes().Where(t => typeof(InteractionBase).IsAssignableFrom(t) && !t.IsAbstract); |
@@ -197,6 +254,10 @@ public Task RegisterModules(Assembly entrypoint) |
197 | 254 | return Task.CompletedTask; |
198 | 255 | } |
199 | 256 |
|
| 257 | + /// <summary> |
| 258 | + /// A function that allows you to redirect an <see cref="Interaction"/> to its corresponding module |
| 259 | + /// </summary> |
| 260 | + /// <param name="interactionContext">The Interaction you pass in as Context</param> |
200 | 261 | public void HandleInteraction(Objects.Interaction interactionContext) |
201 | 262 | { |
202 | 263 | List<object> args = new List<object>() { interactionContext }; |
|
0 commit comments