public void RegisterAdminCommand(DiscordAdmin type, string command, string help, Action <Dictionary <string, object>, SocketMessage> eventMethod) { if ((type == DiscordAdmin.DM && m_guild == null) || type == DiscordAdmin.Global) { DiscordMessageRule rule = new DiscordMessageRule(command, help); DiscordEvent discordEvent = new DiscordEvent(); discordEvent.Rule = rule; discordEvent.Type = type == DiscordAdmin.DM ? DiscordEventType.PrivateMessageRecieved : DiscordEventType.MessageRecieved; discordEvent.Event = eventMethod; AddDiscordEvent(discordEvent); } }
public void RegisterRoleCommand(string command, string help, string roleTags, Action <Dictionary <string, object>, SocketMessage> eventMethod) { if (m_guild != null) { DiscordRoleMessageRule rule = new DiscordRoleMessageRule(m_guild, roleTags, command, help); DiscordEvent discordEvent = new DiscordEvent(); discordEvent.Rule = rule; discordEvent.Type = DiscordEventType.MessageRecieved; discordEvent.Event = eventMethod; AddDiscordEvent(discordEvent); } }
public bool RegisterEvent <T>(IDiscordRule rule, DiscordEventType eventType, Action <Dictionary <string, object>, T> eventMethod) { if (rule.IsEventSupported(eventType)) { DiscordEvent discordEvent = new DiscordEvent(); discordEvent.Rule = rule; discordEvent.Type = eventType; discordEvent.Event = eventMethod; AddDiscordEvent(discordEvent); return(true); } return(false); }
public bool RegisterAdminEvent <T>(DiscordAdmin type, IDiscordRule rule, DiscordEventType eventType, Action <Dictionary <string, object>, T> eventMethod) { if ((type == DiscordAdmin.DM && m_guild == null) || type == DiscordAdmin.Global) { if (rule.IsEventSupported(eventType)) { DiscordEvent discordEvent = new DiscordEvent(); discordEvent.Rule = rule; discordEvent.Type = eventType; discordEvent.Event = eventMethod; AddDiscordEvent(discordEvent); return(true); } } return(false); }
private void AddDiscordEvent(DiscordEvent eventAction) { DiscordEventType type = eventAction.Type; if (m_discordEvents.ContainsKey(type)) { if (m_discordEvents[type] == null) { m_discordEvents[type] = new List <DiscordEvent>(); m_discordEvents[type].Add(eventAction); } else { m_discordEvents[type].Add(eventAction); } } else { m_discordEvents.Add(type, new List <DiscordEvent>()); m_discordEvents[type].Add(eventAction); } }