public async Task UpdateGameConfigAsync(ulong serverId, BotGameConfig config)
        {
            await using var dbContext = new DosDbContext();
            var guildConfig = await GetGuildConfigAsync(dbContext, serverId);

            if (guildConfig == null)
            {
                guildConfig = new GuildConfig
                {
                    GuildId = serverId
                };
                await dbContext.AddAsync(guildConfig);
            }
            guildConfig.Config = config;
            await dbContext.SaveChangesAsync();
        }
예제 #2
0
 private static async Task SendServerDefaultGameConfigAsync(BotGameConfig config, ISocketMessageChannel channel)
 {
     var message = "Server default game configuration:\n" + config.ToDiscordTable();
     await channel.SendMessageAsync(message);
 }