Beispiel #1
0
        public BlacklistService(DbService db, IPubSub pubSub, IBotCredentials creds)
        {
            _db     = db;
            _pubSub = pubSub;
            _creds  = creds;

            Reload(false);
            _pubSub.Sub(blPubKey, OnReload);
        }
Beispiel #2
0
        /// <summary>
        /// Initialized an instance of <see cref="ConfigServiceBase{TSettings}"/>
        /// </summary>
        /// <param name="filePath">Path to the file where the settings are serialized/deserialized to and from</param>
        /// <param name="serializer">Serializer which will be used</param>
        /// <param name="pubSub">Pubsub implementation for signaling when settings are updated</param>
        /// <param name="changeKey">Key used to signal changed event</param>
        protected ConfigServiceBase(string filePath, IConfigSeria serializer, IPubSub pubSub,
                                    TypedKey <TSettings> changeKey)
        {
            _filePath   = filePath;
            _serializer = serializer;
            _pubSub     = pubSub;
            _changeKey  = changeKey;

            Load();
            _pubSub.Sub(_changeKey, OnChangePublished);
        }
Beispiel #3
0
        public CustomReactionsService(PermissionService perms, DbService db, IBotStrings strings, NadekoBot bot,
                                      DiscordSocketClient client, CommandHandler cmd, GlobalPermissionService gperm, CmdCdService cmdCds,
                                      IPubSub pubSub)
        {
            _db      = db;
            _client  = client;
            _perms   = perms;
            _cmd     = cmd;
            _strings = strings;
            _bot     = bot;
            _gperm   = gperm;
            _cmdCds  = cmdCds;
            _pubSub  = pubSub;
            _rng     = new NadekoRandom();

            _pubSub.Sub(_crsReloadedKey, OnCrsShouldReload);
            pubSub.Sub(_gcrAddedKey, OnGcrAdded);
            pubSub.Sub(_gcrDeletedkey, OnGcrDeleted);
            pubSub.Sub(_gcrEditedKey, OnGcrEdited);

            bot.JoinedGuild   += OnJoinedGuild;
            _client.LeftGuild += OnLeftGuild;
        }