public DicePlugin(IConnectionManager connMgr, JObject config) { ConnectionManager = connMgr; Config = new DiceConfig(config); RNG = new Random(); CryptoRNG = new CryptoRandom(); ChannelToCooldown = new Dictionary <string, CooldownState>(); ImmutableList <KeyValuePair <string, IArgumentTaker> > cryptoOption = CommandUtil.MakeOptions( CommandUtil.MakeFlag("--crypto") ) ; ConnectionManager.CommandManager.RegisterChannelMessageCommandHandler( new Command( CommandUtil.MakeNames("roll"), cryptoOption, CommandUtil.MakeArguments(new MultiMatchTaker(RollRegex, RollSeparatorRegex, 1)), CommandUtil.MakeTags("fun"), forbiddenFlags: MessageFlags.UserBanned ), HandleRollCommand ); ConnectionManager.CommandManager.RegisterChannelMessageCommandHandler( new Command( CommandUtil.MakeNames("yn"), cryptoOption, CommandUtil.MakeArguments(RestTaker.Instance), CommandUtil.MakeTags("fun"), forbiddenFlags: MessageFlags.UserBanned ), HandleYesNoCommand ); ConnectionManager.CommandManager.RegisterChannelMessageCommandHandler( new Command( CommandUtil.MakeNames("decide"), cryptoOption, CommandUtil.MakeArguments(RestTaker.Instance), CommandUtil.MakeTags("fun"), forbiddenFlags: MessageFlags.UserBanned ), HandleDecideCommand ); ConnectionManager.CommandManager.RegisterChannelMessageCommandHandler( new Command( CommandUtil.MakeNames("shuffle"), cryptoOption, CommandUtil.MakeArguments(RestTaker.Instance), CommandUtil.MakeTags("fun"), forbiddenFlags: MessageFlags.UserBanned ), HandleShuffleCommand ); ConnectionManager.ChannelMessage += HandleChannelMessage; }
public virtual void ReloadConfiguration(JObject newConfig) { Config = new DiceConfig(newConfig); PostConfigReload(); }