/// <summary>
 ///     Announce the user to a specified channel when streaming.
 /// </summary>
 /// <param name="discordSettings">Settings used to connect to Discord.</param>
 /// <param name="logger">Logger.</param>
 /// <param name="settingsService">Settings serivce.</param>
 public StreamAnnouncerModule(DiscordSocketClient discordSocketClient, ILogger <StreamAnnouncerModule> logger,
                              IModuleSettingsService <StreamAnnouncerSettings> settingsService)
 {
     this.discordSocketClient = discordSocketClient;
     this.logger      = logger;
     _settingsService = settingsService;
 }
Beispiel #2
0
 public ChatTrackerModule(IDiscordSettings discordSettings, ILogger <IModule> logger, IConfiguration config,
                          IServiceScopeFactory scopeFactory, IModuleSettingsService <ChatTrackerSettings> settingsService) : base(
         discordSettings, logger, config)
 {
     _scopeFactory    = scopeFactory;
     _settingsService = settingsService;
 }
Beispiel #3
0
        public async Task <StreamerChannelSettingsViewModel> GetChannelSettingsAnnouncer(
            [FromServices] IDiscordUserGuildService userGuildService,
            [FromServices] IModuleSettingsService <StreamerSettings> streamerSettingsService, ulong guildId,
            ulong channelId)
        {
            // All channel's settings in guild.
            var allChannelSettings = await streamerSettingsService.GetSettingsByGuild(guildId, x => x.ChannelSettings);

            if (allChannelSettings == null)
            {
                return new StreamerChannelSettingsViewModel
                       {
                           Enabled        = false,
                           RemoveMessages = false
                       }
            }
            ;

            // Settings for specific channel.
            var channelSettings = allChannelSettings.ChannelSettings.FirstOrDefault(x => x.ChannelId == channelId);

            var isEnabled = channelSettings != null;

            var settings = new StreamerChannelSettingsViewModel
            {
                Enabled        = isEnabled,
                RemoveMessages = isEnabled && channelSettings.RemoveMessage
            };

            return(settings);
        }
 /// <summary>
 ///     Announce the user to a specified channel when the user starts streaming and assign specified streaming role to the
 ///     user.
 /// </summary>
 /// <param name="discordSettings">Settings used to connect to Discord.</param>
 /// <param name="logger">Logger.</param>
 /// <param name="config">Application configuration.</param>
 /// <param name="settingsService">Settings service.</param>
 /// <param name="scopeFactory">Scope factory.</param>
 public StreamerModule(IDiscordSettings discordSettings, ILogger <StreamerModule> logger,
                       IConfiguration config, IModuleSettingsService <StreamerSettings> settingsService,
                       IServiceScopeFactory scopeFactory) : base(
         discordSettings, logger, config)
 {
     _settingsService = settingsService;
     _scopeFactory    = scopeFactory;
 }
 public CleanChatModule(IDiscordSettings discordSettings, ILogger <IModule> logger, IConfiguration config,
                        IModuleSettingsService <CleanChatSettings> settingsService, IJobService jobService,
                        IServiceScopeFactory scopeFactory) : base(discordSettings, logger, config)
 {
     _settingsService = settingsService;
     _jobService      = jobService;
     _scopeFactory    = scopeFactory;
 }
Beispiel #6
0
        public DadModule(IDiscordSettings discordSettings,
                         ILogger <IModule> logger,
                         IConfiguration config,
                         IModuleSettingsService <DadModuleSettings> moduleSettings)
            : base(discordSettings, logger, config)
        {
            _moduleSettings = moduleSettings;

            _dadName      = config[DadNameKey];
            _matchPattern = config[MatchPatternKey];
            _pattern      = new Regex(config[MatchPatternKey]);
        }
Beispiel #7
0
 public SettingsController(IModuleSettingsService <StreamerSettings> streamAnnouncerSettingsService,
                           IEntityService <StreamerChannelSettings> streamAnnouncerChannelSettingsService,
                           IModuleSettingsService <ChatTrackerSettings> chatTrackerSettingsService,
                           IModuleSettingsService <RemembotSettings> reminderSettingsService,
                           IEntityService <RecurringReminderMessage> recurringReminderService)
 {
     _streamAnnouncerSettingsService        = streamAnnouncerSettingsService;
     _streamAnnouncerChannelSettingsService = streamAnnouncerChannelSettingsService;
     _chatTrackerSettingsService            = chatTrackerSettingsService;
     _reminderSettingsService  = reminderSettingsService;
     _recurringReminderService = recurringReminderService;
 }
Beispiel #8
0
        public DownloadContextService(PackService packService, DownloadStatusService downloadStatusService, IModuleSettingsService moduleSettingsService, DownloadService downloadService, IrcAnimeService.IrcAnimeServiceClient client)
        {
            this.packService           = packService;
            this.downloadStatusService = downloadStatusService;
            this.moduleSettingsService = moduleSettingsService;
            this.downloadService       = downloadService;
            this.client = client;
            this.downloadStatusService.OnStatusUpdate += async() => await this.DownloadStatusService_OnStatusUpdate();

            this.downloadService.OnBytesDownloaded  += this.DownloadService_OnBytesDownloaded;
            this.downloadService.OnDownloadFinished += this.DownloadService_OnDownloadFinished;
        }
Beispiel #9
0
 /// <summary>
 /// .ctor
 /// </summary>
 /// <param name="discordSettings"></param>
 /// <param name="logger"></param>
 /// <param name="config"></param>
 /// <param name="jobService"></param>
 /// <param name="moduleSettings"></param>
 /// <param name="entityChangedDispatcher"></param>
 /// <param name="scopeFactory"></param>
 public RemembotModule(IDiscordSettings discordSettings,
                       ILogger <IModule> logger,
                       IConfiguration config,
                       IJobService jobService,
                       IModuleSettingsService <RemembotSettings> moduleSettings,
                       EntityChangedDispatcher <RecurringReminderMessage> entityChangedDispatcher,
                       IServiceScopeFactory scopeFactory)
     : base(discordSettings, logger, config)
 {
     _jobService              = jobService;
     _moduleSettings          = moduleSettings;
     _entityChangedDispatcher = entityChangedDispatcher;
     _scopeFactory            = scopeFactory;
 }
Beispiel #10
0
 public SettingsController(IModuleSettingsService <StreamerSettings> streamAnnouncerSettingsService,
                           IEntityService <StreamerChannelSettings> streamAnnouncerChannelSettingsService,
                           IModuleSettingsService <ChatTrackerSettings> chatTrackerSettingsService,
                           IModuleSettingsService <RemembotSettings> reminderSettingsService,
                           IEntityService <RecurringReminderMessage> recurringReminderService,
                           IModuleSettingsService <DadModuleSettings> dadSettingsService,
                           IEntityService <WhiteListedRole> whiteListedRoleEntityService)
 {
     _streamAnnouncerSettingsService        = streamAnnouncerSettingsService;
     _streamAnnouncerChannelSettingsService = streamAnnouncerChannelSettingsService;
     _chatTrackerSettingsService            = chatTrackerSettingsService;
     _reminderSettingsService      = reminderSettingsService;
     _recurringReminderService     = recurringReminderService;
     _dadSettingsService           = dadSettingsService;
     _whiteListedRoleEntityService = whiteListedRoleEntityService;
 }
        public ModerationController(IModuleSettingsService <ModerationSettings> moderationSettings,
                                    IEntityService <ProfanityFilter> entityServiceProfanityFilter,
                                    IEntityService <LinkFilter> entityServiceLinkFilter,
                                    IEntityService <WhitelistedChannel> entityServiceWhitelistedChannels,
                                    IEntityService <WhitelistedRole> entityServiceWhitelistedRoles,
                                    IEntityService <WhitelistedLink> entityServiceWhitelistedLinks,
                                    IEntityService <BannedWord> entityServiceBannedWords,
                                    IEntityService <Punishment> entityServicePunishments,
                                    IEntityService <Warning> entityServiceWarnings,
                                    IEntityService <ActivePunishment> entityServiceActivePunishments,
                                    IEntityService <UserWarnings> entityServiceUsers,
                                    IDiscordUserService discordUserService,
                                    IPunishmentService punishmentService,
                                    IWarningService warningService,
                                    IModerationModuleUtils moderationModuleUtils
                                    )
        {
            _moderationSettings = moderationSettings;

            _entityServiceProfanityFilter = entityServiceProfanityFilter;

            _entityServiceLinkFilter = entityServiceLinkFilter;

            _entityServiceWhitelistedChannels = entityServiceWhitelistedChannels;

            _entityServiceWhitelistedRoles = entityServiceWhitelistedRoles;

            _entityServiceWhitelistedLinks = entityServiceWhitelistedLinks;

            _entityServiceBannedWords = entityServiceBannedWords;

            _entityServicePunishments = entityServicePunishments;

            _entityServiceWarnings = entityServiceWarnings;

            _entityServiceActivePunishments = entityServiceActivePunishments;

            _entityServiceUsers = entityServiceUsers;

            _discordUserService = discordUserService;

            _punishmentService = punishmentService;

            _warningService = warningService;

            _moderationModuleUtils = moderationModuleUtils;
        }
 public ModerationModuleUtils(IModuleSettingsService <ModerationSettings> settingsService)
 {
     _settingsService = settingsService;
 }
Beispiel #13
0
 public DownloadService(IrcAnimeService.IrcAnimeServiceClient client, IModuleSettingsService settingsService)
 {
     this.client          = client;
     this.settingsService = settingsService;
 }
 /// <summary>
 ///     Assign a user the streaming role.
 /// </summary>
 /// <param name="discordSettings">Settings used to connect to Discord.</param>
 /// <param name="logger">Logger.</param>
 /// <param name="config">Application configuration.</param>
 /// <param name="settingsService">Settings service.</param>
 public StreamerRoleModule(IDiscordSettings discordSettings, ILogger <StreamerRoleModule> logger,
                           IConfiguration config, IModuleSettingsService <StreamerRoleSettings> settingsService) : base(discordSettings,
                                                                                                                        logger, config)
 {
     _settingsService = settingsService;
 }
 /// <summary>
 /// Announce the user to a specified channel when streaming.
 /// </summary>
 /// <param name="discordSettings">Settings used to connect to Discord.</param>
 /// <param name="logger">Logger.</param>
 /// <param name="settingsService">Settings serivce.</param>
 public StreamAnnouncerModule(IDiscordSettings discordSettings, ILogger <StreamAnnouncerModule> logger, IModuleSettingsService <StreamAnnouncerSettings> settingsService) : base(discordSettings, logger)
 {
     _settingsService = settingsService;
 }
 public SettingsController(IModuleSettingsService <StreamAnnouncerSettings> streamAnnouncerSettingsService)
 {
     _streamAnnouncerSettingsService = streamAnnouncerSettingsService;
 }
Beispiel #17
0
 public GuildEnabledCommandDecorator(IModuleSettingsService <TSettings> settings, ICommand command)
 {
     this.settingsService = settings;
     this.command         = command;
 }
        /// <summary>Gets the portal settings service.</summary>
        /// <param name="moduleId">The portal ID.</param>
        /// <returns>A <see cref="IPortalSettingsService" /> instance.</returns>
        private IModuleSettingsService GetModuleSettingsService(int moduleId)
        {
            if (this.moduleSettingsService == null)
            {
                this.moduleSettingsService = new ModuleSettingsService(moduleId);
            }

            return this.moduleSettingsService;
        }
 /// <summary>Initializes a new instance of the <see cref="FeaturesController" /> class.</summary>
 /// <param name="portalSettingsService">The portal settings service, or <c>null</c>.</param>
 /// <param name="moduleSettingsService">The module settings service, or <c>null</c>.</param>
 internal FeaturesController(IPortalSettingsService portalSettingsService, IModuleSettingsService moduleSettingsService)
 {
     this.portalSettingsService = portalSettingsService;
     this.moduleSettingsService = moduleSettingsService;
 }