Exemple #1
0
        public async Task <GuildSettings> GetOrCreateGuildSettingsAsync(IGuild guild)
        {
            var record = _coreContext.GuildsSettings.SingleOrDefault(x => x.GuildId == guild.Id);

            if (record == null)
            {
                _logging.Log($"Registering guild settings for {guild.Name} ({guild.Id})...",
                             LogSeverity.Info);
                record = new GuildSettings {
                    GuildId = guild.Id
                };
                _coreContext.GuildsSettings.Add(record);
                await SaveRepositoryAsync().ConfigureAwait(false);
            }
            return(record);
        }
Exemple #2
0
        public async Task AddGuildSettingsAsync(GuildSettings greetingSettings)
        {
            await _coreContext.GuildsSettings.AddAsync(greetingSettings).ConfigureAwait(false);

            await SaveRepositoryAsync().ConfigureAwait(false);
        }
Exemple #3
0
 public Task RemoveGuildSettingsAsync(GuildSettings greetingSettings)
 {
     _coreContext.GuildsSettings.Remove(greetingSettings);
     return(SaveRepositoryAsync());
 }