|
| 1 | +using System; |
| 2 | +using System.Collections.Generic; |
| 3 | +using System.Linq; |
| 4 | +using System.Reflection; |
| 5 | +using System.Runtime.CompilerServices; |
| 6 | +using System.Text; |
| 7 | +using System.Threading.Tasks; |
| 8 | + |
| 9 | +namespace Amino.Interactions |
| 10 | +{ |
| 11 | + public partial class InteractionsClient |
| 12 | + { |
| 13 | + |
| 14 | + public Dictionary<string, Objects.InteractionModule> InteractionModules; |
| 15 | + public Queue<Objects.Interaction> InteractionQueue; |
| 16 | + |
| 17 | + public enum LogLevels |
| 18 | + { |
| 19 | + None, |
| 20 | + Debug, |
| 21 | + Warning, |
| 22 | + Error |
| 23 | + } |
| 24 | + |
| 25 | + private Amino.Client AminoClient; |
| 26 | + public int InteractionCooldown = 2000; |
| 27 | + public string InteractionPrefix = "/"; |
| 28 | + public bool IgnoreSelf = true; |
| 29 | + public LogLevels LogLevel = LogLevels.None; |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | + public InteractionsClient(Amino.Client client) |
| 34 | + { |
| 35 | + this.AminoClient = client; |
| 36 | + this.InteractionQueue = new Queue<Objects.Interaction>(); |
| 37 | + this.InteractionModules = new Dictionary<string, Objects.InteractionModule>(); |
| 38 | + _ = Task.Run(async () => { HandleInteractionQueue(); }); |
| 39 | + } |
| 40 | + |
| 41 | + |
| 42 | + public Task RegisterModule<T>() where T : InteractionBase |
| 43 | + { |
| 44 | + |
| 45 | + } |
| 46 | + |
| 47 | + public Task RegisterModules(Assembly entrypoint) |
| 48 | + { |
| 49 | + |
| 50 | + } |
| 51 | + |
| 52 | + public bool HandleInteraction(Objects.Interaction interaction) |
| 53 | + { |
| 54 | + |
| 55 | + } |
| 56 | + |
| 57 | + private async Task HandleInteractionQueue() |
| 58 | + { |
| 59 | + while(true) |
| 60 | + { |
| 61 | + if(InteractionQueue.Count != 0) |
| 62 | + { |
| 63 | + HandleInteraction(InteractionQueue.Dequeue()); |
| 64 | + } |
| 65 | + await Task.Delay(this.InteractionCooldown); |
| 66 | + } |
| 67 | + } |
| 68 | + |
| 69 | + |
| 70 | + } |
| 71 | +} |
0 commit comments