示例#1
0
        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);
        }
示例#2
0
 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);
 }