Пример #1
0
        /// <summary>
        /// Removes an event from the queue given it's embed
        /// </summary>
        /// <remarks>
        /// -C
        /// </remarks>
        /// <param name="node">The node to remove</param>
        public static void RemoveEvent(ActionEmbed node)
        {
            ulong id = node.CommandCaller.Id;

            foreach (EventQueueNode e in EventQueue[node.CommandCaller.Id])
            {
                if (e.EventAction == node)
                {
                    EventQueue[id].Remove(e);
                    break;
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Adds an interface to the event queue
        /// </summary>
        /// -C
        /// <param name="embed">The interface to add</param>
        public static void AddEvent(ActionEmbed embed)
        {
            ulong id = embed.CommandCaller.Id;

            bool alone = embed is MessageEmbed;

            if (EventQueue.ContainsKey(id))
            {
                // If the user is in the queue
                EventQueue[id].Add(new EventQueueNode(embed, alone));  // Add the action to their list
            }
            else
            {
                // otherwise
                EventQueue.Add(id, new List <EventQueueNode>());      // Create the list
                EventQueue[id].Add(new EventQueueNode(embed, alone)); // And add the action to their list
            }
        }
Пример #3
0
        public static async Task CloseActionEmbedAsync(ActionEmbed embed)
        {
            await embed.Message.ModifyAsync(x => x.Content = BotUtils.KamtroText("This embed is no longer in use.")); // Notify the user that the embed is disabled

            await embed.Message.ModifyAsync(x => x.Embed = null);                                                     // Remove embed
        }
Пример #4
0
        public bool IsAlone = false;    // This tells other classes if this object is alone (AKA in an action event), or is paired up with another type of event node (AKA in a message event)

        public EventQueueNode(ActionEmbed action, bool isAlone = false)
        {
            IsAlone     = isAlone;
            EventAction = action;
            TimeCreated = DateTime.Now;
        }