Exemplo n.º 1
0
 public ChatClientsController(
     IOptionsSnapshot <ChatClientsSettings> chatClientsSettingsAccessor,
     IOptionsSnapshot <BotClientSettings> botClientsSettingsAccessor)
 {
     _chatClientsSettings = chatClientsSettingsAccessor.Value;
     _botClientsSettings  = botClientsSettingsAccessor.Value;
 }
Exemplo n.º 2
0
 public ChatClientsController(
     ChatClientsSettingsProvider chatClientsSettingsProvider,
     BotClientSettingsProvider botClientSettingsProvider)
 {
     _chatClientsSettings = chatClientsSettingsProvider.Provide();
     _botClientsSettings  = botClientSettingsProvider.Provide();
 }
Exemplo n.º 3
0
        public static void Update(BotClientSettings botClientSettings, ChatClientsSettings chatClientsSettings)
        {
            SettingsFile.Write(settings =>
            {
                settings.ChatClients.Discord.BotToken      = chatClientsSettings.Discord.BotToken;
                settings.ChatClients.Discord.ClientId      = chatClientsSettings.Discord.ClientId;
                settings.ChatClients.Discord.StatusMessage = chatClientsSettings.Discord.StatusMessage;
                settings.ChatClients.Discord.EnableDirectMessageSupport = chatClientsSettings.Discord.EnableDirectMessageSupport;

                settings.BotClient.Client            = botClientSettings.Client;
                settings.BotClient.MonitoredChannels = botClientSettings.MonitoredChannels;
                settings.BotClient.CommandPrefix     = botClientSettings.CommandPrefix;
            });
        }
        public static void Update(BotClientSettings botClientSettings, ChatClientsSettings chatClientsSettings)
        {
            SettingsFile.Write(settings =>
            {
                settings.ChatClients.Discord.BotToken          = chatClientsSettings.Discord.BotToken;
                settings.ChatClients.Discord.ClientId          = chatClientsSettings.Discord.ClientId;
                settings.ChatClients.Discord.StatusMessage     = chatClientsSettings.Discord.StatusMessage;
                settings.ChatClients.Discord.MonitoredChannels = JToken.FromObject(chatClientsSettings.Discord.MonitoredChannels);
                settings.ChatClients.Discord.TvShowRoles       = JToken.FromObject(chatClientsSettings.Discord.TvShowRoles);
                settings.ChatClients.Discord.MovieRoles        = JToken.FromObject(chatClientsSettings.Discord.MovieRoles);
                settings.ChatClients.Discord.EnableRequestsThroughDirectMessages = chatClientsSettings.Discord.EnableRequestsThroughDirectMessages;
                settings.ChatClients.Discord.AutomaticallyNotifyRequesters       = chatClientsSettings.Discord.AutomaticallyNotifyRequesters;
                settings.ChatClients.Discord.NotificationMode     = chatClientsSettings.Discord.NotificationMode;
                settings.ChatClients.Discord.NotificationChannels = JToken.FromObject(chatClientsSettings.Discord.NotificationChannels);
                settings.ChatClients.Discord.AutomaticallyPurgeCommandMessages = chatClientsSettings.Discord.AutomaticallyPurgeCommandMessages;
                settings.ChatClients.Discord.DisplayHelpCommandInDMs           = chatClientsSettings.Discord.DisplayHelpCommandInDMs;

                settings.BotClient.Client        = botClientSettings.Client;
                settings.BotClient.CommandPrefix = botClientSettings.CommandPrefix;
            });
        }
        public static void Update(BotClientSettings botClientSettings, ChatClientsSettings chatClientsSettings)
        {
            SettingsFile.Write(settings =>
            {
                settings.ChatClients.Discord.BotToken          = chatClientsSettings.Discord.BotToken;
                settings.ChatClients.Discord.ClientId          = chatClientsSettings.Discord.ClientId;
                settings.ChatClients.Discord.StatusMessage     = chatClientsSettings.Discord.StatusMessage;
                settings.ChatClients.Discord.MonitoredChannels = JToken.FromObject(chatClientsSettings.Discord.MonitoredChannels);
                settings.ChatClients.Discord.TvShowRoles       = JToken.FromObject(chatClientsSettings.Discord.TvShowRoles);
                settings.ChatClients.Discord.MovieRoles        = JToken.FromObject(chatClientsSettings.Discord.MovieRoles);
                settings.ChatClients.Discord.EnableRequestsThroughDirectMessages = chatClientsSettings.Discord.EnableRequestsThroughDirectMessages;
                settings.ChatClients.Discord.AutomaticallyNotifyRequesters       = chatClientsSettings.Discord.AutomaticallyNotifyRequesters;
                settings.ChatClients.Discord.NotificationMode     = chatClientsSettings.Discord.NotificationMode;
                settings.ChatClients.Discord.NotificationChannels = JToken.FromObject(chatClientsSettings.Discord.NotificationChannels);
                settings.ChatClients.Discord.AutomaticallyPurgeCommandMessages = chatClientsSettings.Discord.AutomaticallyPurgeCommandMessages;

                settings.BotClient.Client = botClientSettings.Client;

                settings.ChatClients.Language = chatClientsSettings.Language.ToLower();
                Language.Current = JsonConvert.DeserializeObject <Language>(File.ReadAllText($"locales/{settings.ChatClients.Language}.json"));
            });
        }