Example #1
0
        public async Task SetPrefixAsync(LiteGuildConfig config, string prefix)
        {
            if (string.IsNullOrWhiteSpace(prefix))
            {
                config.Prefix = null;
            }
            else
            {
                config.Prefix = prefix;
            }

            GuildConfigs.Update(config);
            await SaveChangesAsync();
        }
Example #2
0
        public async Task <LiteGuildConfig> GetConfigAsync(ulong guildId)
        {
            var config = await GuildConfigs.FirstOrDefaultAsync(x => x.GuildId == guildId);

            if (config != null)
            {
                return(config);
            }

            config = new LiteGuildConfig(guildId);
            await GuildConfigs.AddAsync(config);

            await SaveChangesAsync();

            return(config);
        }